Solved

Paste Special VBScript

Posted on 2011-09-16
4
2,073 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 51

Accepted Solution

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

Author Comment

by:drezner7
ID: 36551078
Thx
0
 
LVL 45

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 51

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

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Welcome, welcome!  If you are new to the series and haven't been following along, please take a brief moment to review the first three installments: Part 1 (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_266-VBScri…
Introduction During my participation as a VBScript contributor at Experts Exchange, one of the most common questions I come across is this: "I have a script that runs against only one computer. How can I make it run against a list of computers in …
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…

757 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

Need Help in Real-Time?

Connect with top rated Experts

22 Experts available now in Live!

Get 1:1 Help Now