create a dynamic Range()

  • Thread starter Thread starter rbaldwin
  • Start date Start date
R

rbaldwin

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("DataFeeds1").Range("A1")).Value)

Sub mysub (Target As Range)
.....
end sub

But inside mySub Target is A1!!
:confused:

Admittedly i'm somewhat new to this.
Your Help is sincerely appreciated
 
If I understood what you're trying to do:

With Worksheets("DataFeeds1")
mysub .Range(.Range("A1").Value)
End With
 
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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top