Solved

Paste Special VBScript

Posted on 2011-09-16
4
2,402 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 55

Accepted Solution

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

Author Comment

by:drezner7
ID: 36551078
Thx
0
 
LVL 47

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 55

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

Enroll in June's Course of the Month

June's Course of the Month is now available! Every 10 seconds, a consumer gets hit with ransomware. Refresh your knowledge of ransomware best practices by enrolling in this month's complimentary course for Premium Members, Team Accounts, and Qualified Experts.

Question has a verified solution.

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

When it comes to writing scripts for a Client/Server computing environment it is essential to consider some way of enabling the authentication functionality within a script. This sort of consideration mainly comes into the picture when we are dealin…
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.

707 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