Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I have set "G" as the a range.
In the later part, I need to use "G" as a reference to set itself as another range. what is the correct syntex? Set G = Worksheets(E).Range("B21") .... Set G = Range(G).End(xlRight) <-----Error occurs here Please help! |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You are confusing the range with its name:
Set G = Worksheets(E).Range("B21") Set G = G.End(xlRight) -- Gary''s Student - gsnu201001 "Terry" wrote: I have set "G" as the a range. In the later part, I need to use "G" as a reference to set itself as another range. what is the correct syntex? Set G = Worksheets(E).Range("B21") ... Set G = Range(G).End(xlRight) <-----Error occurs here Please help! |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Terry,
Also should be xlToright not just xlRight Set g = Worksheets(E).Range("B21") Set g = g.End(xlToRight) I assume that E is set to a numeric value for the worksheet. If the name of the worksheet is E then the E should be in double quotes. -- Regards, OssieMac "Gary''s Student" wrote: You are confusing the range with its name: Set G = Worksheets(E).Range("B21") Set G = G.End(xlRight) -- Gary''s Student - gsnu201001 "Terry" wrote: I have set "G" as the a range. In the later part, I need to use "G" as a reference to set itself as another range. what is the correct syntex? Set G = Worksheets(E).Range("B21") ... Set G = Range(G).End(xlRight) <-----Error occurs here Please help! |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi OssieMac,
Thank you very much for the advise! it works perfect! "OssieMac" wrote: Hi Terry, Also should be xlToright not just xlRight Set g = Worksheets(E).Range("B21") Set g = g.End(xlToRight) I assume that E is set to a numeric value for the worksheet. If the name of the worksheet is E then the E should be in double quotes. -- Regards, OssieMac "Gary''s Student" wrote: You are confusing the range with its name: Set G = Worksheets(E).Range("B21") Set G = G.End(xlRight) -- Gary''s Student - gsnu201001 "Terry" wrote: I have set "G" as the a range. In the later part, I need to use "G" as a reference to set itself as another range. what is the correct syntex? Set G = Worksheets(E).Range("B21") ... Set G = Range(G).End(xlRight) <-----Error occurs here Please help! |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to refer to a range except one cell | Excel Discussion (Misc queries) | |||
Refer to first cell in range | Excel Programming | |||
Refer to a Single cell in a name range | Excel Worksheet Functions | |||
How do I refer a Range to a Cell | Excel Worksheet Functions | |||
Can VLookup refer to a cell with a range name? | Excel Programming |