Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a dynamic Range()
i need to pass to a Sub a parameter TargetRange As Range
i want my macro to pick up the target range location from a cell on on of the sheets. for example: in cell a1 i have the value "B10" i need to pass the value in a1 as a Range to my Sub. i tried Dim TR TR Range(Worksheets("DataFeeds1").Range(Worksheets("D ataFeeds1").Range("A1")).Value) Sub mysub (Target As Range) ..... end sub But inside mySub Target is A1!! Admittedly i'm somewhat new to this. Your Help is sincerely appreciated -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a dynamic Range()
change your
dim TR to Dim TR as range -----Original Message----- i need to pass to a Sub a parameter TargetRange As Range i want my macro to pick up the target range location from a cell on one of the sheets. for example: in cell a1 i have the value "B10" i need to pass the value in a1 as a Range to my Sub. i tried Dim TR TR = Range(Worksheets("DataFeeds1").Range(Worksheets ("DataFeeds1").Range("A1")).Value) Sub mysub (Target As Range) ..... end sub But inside mySub Target is A1!! Admittedly i'm somewhat new to this. Your Help is sincerely appreciated. --- Message posted from http://www.ExcelForum.com/ . |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a dynamic Range()
If I understood what you're trying to do:
With Worksheets("DataFeeds1") mysub .Range(.Range("A1").Value) End With In article , rbaldwin wrote: i need to pass to a Sub a parameter TargetRange As Range i want my macro to pick up the target range location from a cell on one of the sheets. for example: in cell a1 i have the value "B10" i need to pass the value in a1 as a Range to my Sub. i tried Dim TR TR = Range(Worksheets("DataFeeds1").Range(Worksheets("D ataFeeds1").Range("A1")).Val ue) Sub mysub (Target As Range) .... end sub But inside mySub Target is A1!! Admittedly i'm somewhat new to this. Your Help is sincerely appreciated. --- Message posted from http://www.ExcelForum.com/ |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
create a dynamic Range()
and use Set for the assignment
-- HTH Bob Phillips ... looking out across Poole Harbour to the Purbecks (remove nothere from the email address if mailing direct) "steve" wrote in message ... change your dim TR to Dim TR as range -----Original Message----- i need to pass to a Sub a parameter TargetRange As Range i want my macro to pick up the target range location from a cell on one of the sheets. for example: in cell a1 i have the value "B10" i need to pass the value in a1 as a Range to my Sub. i tried Dim TR TR = Range(Worksheets("DataFeeds1").Range(Worksheets ("DataFeeds1").Range("A1")).Value) Sub mysub (Target As Range) ..... end sub But inside mySub Target is A1!! Admittedly i'm somewhat new to this. Your Help is sincerely appreciated. --- Message posted from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
How to create a dynamic named range? | Excel Discussion (Misc queries) | |||
Create comma-delimited string from dynamic range? | Excel Discussion (Misc queries) | |||
#value! error trying to create a simple dynamic named range | Excel Discussion (Misc queries) | |||
Using dynamic range to create pivot table | Excel Discussion (Misc queries) | |||
How do I create a dynamic range in a macro | Excel Worksheet Functions |