Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 141
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 4,624
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11,272
Default 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
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 dynamic named range? Sunita Excel Discussion (Misc queries) 3 March 28th 08 07:47 PM
Create comma-delimited string from dynamic range? Ptyrider Excel Discussion (Misc queries) 2 November 26th 07 09:04 AM
#value! error trying to create a simple dynamic named range Janis Excel Discussion (Misc queries) 1 August 3rd 07 07:20 PM
Using dynamic range to create pivot table cursednomore Excel Discussion (Misc queries) 5 March 12th 07 02:40 PM
How do I create a dynamic range in a macro Mark2122 Excel Worksheet Functions 2 February 2nd 07 09:44 PM


All times are GMT +1. The time now is 01:52 AM.

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

About Us

"It's about Microsoft Excel"