?
Solved

Paste Special VBScript

Posted on 2011-09-16
4
Medium Priority
?
3,023 Views
Last Modified: 2012-05-12
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
0
Comment
Question by:drezner7
  • 2
4 Comments
 
LVL 59

Accepted Solution

by:
Bill Prew earned 2000 total points
ID: 36551009
0
 

Author Comment

by:drezner7
ID: 36551078
Thx
0
 
LVL 50

Expert Comment

by:Martin Liss
ID: 36551278
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

0
 
LVL 59

Expert Comment

by:Bill Prew
ID: 36551550
@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
0

Featured Post

New feature and membership benefit!

New feature! Upgrade and increase expert visibility of your issues with Priority Questions.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
Is your data getting by on basic protection measures? In today’s climate of debilitating malware and ransomware—like WannaCry—that may not be enough. You need to establish more than basics, like a recovery plan that protects both data and endpoints.…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Suggested Courses

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question