Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default How to reset the range name to refer to another cell?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,058
Default How to reset the range name to refer to another cell?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default How to reset the range name to refer to another cell?

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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 193
Default How to reset the range name to refer to another cell?

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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to refer to a range except one cell hs Excel Discussion (Misc queries) 4 December 6th 09 11:05 PM
Refer to first cell in range art Excel Programming 20 November 2nd 08 11:56 PM
Refer to a Single cell in a name range Jitendra Kumar Excel Worksheet Functions 1 October 18th 06 02:23 PM
How do I refer a Range to a Cell Mal Excel Worksheet Functions 6 June 7th 05 08:47 AM
Can VLookup refer to a cell with a range name? JohnI Excel Programming 0 August 26th 03 02:15 PM


All times are GMT +1. The time now is 08:16 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"