Link to home
Start Free TrialLog in
Avatar of drezner7
drezner7

asked on

Paste Special VBScript

I am trying to copy one column from the same sheet in excel to another column, but paste it as paste special only the values. I have tried this in my vbscript code, but it does not work

Selection.PasteSpecial Paste = xlPasteValues

Can you help

Here is the code:

Osheet2.Range("H3:H789").Select
oExcel.Selection.Copy
oSheet2.Range("A3").Select
Selection.PasteSpecial Paste = xlPasteValues
ASKER CERTIFIED SOLUTION
Avatar of Bill Prew
Bill Prew

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of drezner7
drezner7

ASKER

Thx
You have your answer but in case you're not aware when you want to find out how to do something in Excel you can record and then copy a macro. I just recoreded this one.


    Selection.Copy
    Range("C8").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
        :=False, Transpose:=False

Open in new window

@MartinLiss

Yes, that's a great tool, but the problem in this case is that it will produce VBA code to accomplish the task, and that is not the same as a standalone VBS script.  Some of the VBA constructs and operators are not available in VBS.  That's why we have to use a different approach here.

~bp