Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
How to create a range address with ADDRESS function? | Excel Worksheet Functions | |||
getting the absolute range address from a dynamic named range | Excel Programming | |||
setting range().hidden=True causes range error 1004 | Excel Programming | |||
Is there a template for setting up a address book? | Excel Discussion (Misc queries) | |||
Setting a variable cell address | Excel Discussion (Misc queries) |