Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default setting Range from address

Hi,

Depending on the value of Range("a1"), a range address is stored in
Range ("b1") as follows: Master!$B$31:$B$52. How can I use the value
in Range("b1") to set a range in vba code?

Any other suggestions also welcome.

Thanks in advance for the help.

Regards,
Raj
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default setting Range from address

Something like this...

Set MyRange = Range(Range("B1").Value)

or this...

Set MyRange = Range(Cells(1, "B").Value)

(depending on how you need to reference the range) should work.

Rick


"Raj" wrote in message
...
Hi,

Depending on the value of Range("a1"), a range address is stored in
Range ("b1") as follows: Master!$B$31:$B$52. How can I use the value
in Range("b1") to set a range in vba code?

Any other suggestions also welcome.

Thanks in advance for the help.

Regards,
Raj


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default setting Range from address

Hi Raj,

Try something like:

'==========
Public Sub TestIt()
Dim WB As Workbook
Dim SH As Worksheet
Dim sStr As String
Dim arr As Variant
Dim rng As Range

Set WB = ThisWorkbook '<<==== CHANGE
Set SH = WB.Sheets("DataSheet") '<<==== CHANGE

sStr = ActiveSheet.Range("B1").Value
arr = Split(sStr, "!")

Set rng = WB.Sheets(arr(0)).Range(arr(1))
MsgBox rng.Address(External:=True)
End Sub
'<<==========



---
Regards.
Norman


"Raj" wrote in message
...
Hi,

Depending on the value of Range("a1"), a range address is stored in
Range ("b1") as follows: Master!$B$31:$B$52. How can I use the value
in Range("b1") to set a range in vba code?

Any other suggestions also welcome.

Thanks in advance for the help.

Regards,
Raj


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 421
Default setting Range from address

Hi Raj,

As Rick demonstrates, it is not necessary
to split the text in the cell.

Therefore, go with Rick's better and simpler
sugestion.



---
Regards.
Norman
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 150
Default setting Range from address

Thanks.It worked



On May 26, 9:58*pm, "Norman Jones"
wrote:
Hi Raj,

As Rick demonstrates, it is not necessary
to split the text in the cell.

Therefore, go with Rick's better and simpler
sugestion.

---
Regards.
Norman


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 create a range address with ADDRESS function? Steve McLeod Excel Worksheet Functions 1 December 18th 08 02:02 PM
getting the absolute range address from a dynamic named range junoon Excel Programming 2 March 21st 06 01:29 PM
setting range().hidden=True causes range error 1004 STEVE BELL Excel Programming 6 September 2nd 05 02:16 AM
Is there a template for setting up a address book? Jace Excel Discussion (Misc queries) 1 August 22nd 05 03:42 AM
Setting a variable cell address Hugh Jago Excel Discussion (Misc queries) 3 January 5th 05 03:45 PM


All times are GMT +1. The time now is 07:01 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"