Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need VBScript Equivalent of VBA Excel Copy Method 1

Status
Not open for further replies.

Rob94

Programmer
Mar 30, 2004
19
US
Can anyone help me find the VBScript eqivalent of the VBA code listed below? I'm pretty sure VBScript does not support named arguments, so I'm even wondering if this is even possible. Here it is:

Code:
Sub Macro2()
    Sheets("Sheet1 (2)").Select
    Sheets("Sheet1 (2)").Copy Before:=Workbooks("Book2").Sheets(1)
End Sub

Any help would be greatly appreciated.
 
Hello Rob94,

Just make the named arguments to positional usually suffice.
Code:
Sub Macro2()
    Sheets("Sheet1 (2)").Select
    'case needed "before"
    Sheets("Sheet1 (2)").Copy Workbooks("Book2").Sheets(1)
    'case needed "after
    Sheets("Sheet1 (2)").Copy ,Workbooks("Book2").Sheets(1)
End Sub
regards - tsuji
 
In the "case needed after" section, do I need to put a set of empty quotation marks before the comma, like this:

Code:
'case needed "after
Sheets("Sheet1 (2)").Copy "",Workbooks("Book2").Sheets(1)

Sorry, I'm not in a psoition to test this code out yet, but I wanted to ask the question first. Thanks!
 
tsuji,

this worked like a charm. thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top