LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming,microsoft.public.scripting.vbscript
external usenet poster
 
Posts: 8
Default PasteSpecial: values and formats possible in vbs?

I use the following code in vbs to copy and paste data from one Excel cell
to another:

XLBook.Worksheets("Sheet1").Select
XLBook.Worksheets("Sheet1").Range("A1").Copy
XLBook.Worksheets("Sheet1").Range("B1").PasteSpeci al

My code above does a regular paste, but I need to do a paste special that
only pastes values and number formats. I've created a macro in Excel that
does this and the vba code for it is:

Range("A1").Select
Selection.Copy
Range("B1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats,
Operation:=xlNone, SkipBlanks:=False, Transpose:=False

However, the vba code above does not work in vbs. It throws an Expceted
Statement error at the first colon (:) in the PasteSpecial line. Does anyone
know how I can do this in vbs?


 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
key shortcut for PasteSpecial-Values Jarek Kujawa[_2_] Excel Discussion (Misc queries) 1 July 16th 08 01:34 PM
PasteSpecial / Formats also pastes a random range name Tim Zych Excel Discussion (Misc queries) 0 November 10th 06 05:03 AM
Command Button for PasteSpecial - Values - Transpose Alisha Excel Discussion (Misc queries) 0 March 10th 06 09:39 PM
PasteSpecial Values Patch[_2_] Excel Programming 3 August 16th 04 07:41 PM
How do I make a button to PasteSpecial Values only. Rick[_17_] Excel Programming 2 November 5th 03 01:34 PM


All times are GMT +1. The time now is 03:19 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"