Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
Hi All........
Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... TIA Vaya con Dios, Chuck, CABGx3 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
Hi Chuck,
Try deleting the quotes: Worksheets(MyName).select Copy Destination:=Worksheets(MyName).Range("A1") --- Regards, Norman "CLR" wrote in message ... Hi All........ Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... TIA Vaya con Dios, Chuck, CABGx3 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
Having trouble here with the lines of code
Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... If MyName is a variable, exclude the "" - viz: Worksheets(MyName).select and Copy Destination:=Worksheets(MyName).Range("A1") |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
On May 18, 11:07 am, CLR wrote:
Hi All........ Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... TIA Vaya con Dios, Chuck, CABGx3 Dont use quotes |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
So cool when you "know how"...<G
Thanks Norman Vaya con Dios, Chuck, CABGx3 "Norman Jones" wrote: Hi Chuck, Try deleting the quotes: Worksheets(MyName).select Copy Destination:=Worksheets(MyName).Range("A1") --- Regards, Norman "CLR" wrote in message ... Hi All........ Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... TIA Vaya con Dios, Chuck, CABGx3 |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
Got it..........thanks IanKR
Vaya con Dios, Chuck, CABGx3 "IanKR" wrote: Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... If MyName is a variable, exclude the "" - viz: Worksheets(MyName).select and Copy Destination:=Worksheets(MyName).Range("A1") |
#7
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
Got it...........thanks Nick
Vaya con Dios, Chuck, CABGx3 "Nick" wrote: On May 18, 11:07 am, CLR wrote: Hi All........ Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... TIA Vaya con Dios, Chuck, CABGx3 Dont use quotes |
#8
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
Not as exciting when you hear it the 3rd time <g
-- Regards, Tom Ogilvy "CLR" wrote: Got it...........thanks Nick Vaya con Dios, Chuck, CABGx3 "Nick" wrote: On May 18, 11:07 am, CLR wrote: Hi All........ Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... TIA Vaya con Dios, Chuck, CABGx3 Dont use quotes |
#9
Posted to microsoft.public.excel.programming
|
|||
|
|||
Worksheets("MyName").select
True Tom.....LOL, but I spent a couple hours anguishing over that problem
before asking, and then it went so well with the "right" answer.......I just love it when a plan comes together......I'd be in a heap of doo-doo with out the help I get here. Vaya con Dios, Chuck, CABGx3 "Tom Ogilvy" wrote: Not as exciting when you hear it the 3rd time <g -- Regards, Tom Ogilvy "CLR" wrote: Got it...........thanks Nick Vaya con Dios, Chuck, CABGx3 "Nick" wrote: On May 18, 11:07 am, CLR wrote: Hi All........ Having trouble here with the lines of code Worksheets("MyName").select and Copy Destination:=Worksheets("MyName").Range("A1") where MyName is a variable, declared and set earlier.......I get "Runtime error 9, Subscript out of range" error and macro won't pass that point. How else might I be able to refer to that sheet whose name changes as the macro goes along....... TIA Vaya con Dios, Chuck, CABGx3 Dont use quotes |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
"Control" plus "click" doesn't allow me to select multiple cells | New Users to Excel | |||
Problem: Worksheets("New Style 2006").Unprotect Password:="naPrint" | Excel Programming | |||
use variable in Workbooks("book1").Worksheets("sheet1").Range("a1" | Excel Programming | |||
IF(VLOOKUP("MYDATA", MYNAME, 4) = 0, "TRUE", "FALSE") | Excel Programming | |||
Using "Cells" to write "Range("A:A,H:H").Select" | Excel Programming |