LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 142
Default pass named range address into variable

On Mar 22, 7:36 am, "okrob" wrote:
On Mar 21, 9:18 pm, "NickHK" wrote:





If the WB is not open, the normal way of dealing with data is ADO. Depends
on the structure of the data.


NickHK


"okrob" wrote in message


roups.com...


On Mar 21, 4:37 pm, Gleam wrote:
s1= [data1].Address


"okrob" wrote:
How can I create a string variable from a named range in a workbook?


ex:


Named range is at address: $D$11:$AB$11
Name is: data1
String I want passed into a variable is: "D11:AB11" or "$D$11:$AB$11"


Thanks
Rob- Hide quoted text -


- Show quoted text -


OK, Blonde moment...!!!
I forgot to mention that the range is in an unopened workbook...- Hide quoted text -


- Show quoted text -


That's what I figured, but I can't seem to get the address into a
variable. I can get the data, one cell at a time (not feasible
because the data moves about), but not the entire range... I can use
Ron de Bruin's code, but the data address is dynamic. Only the range
name stays the same. So, to use Ron's code, I have to modify it to
accept a string for the cell references. I have that done already,
but I can't get the string...- Hide quoted text -

- Show quoted text -


FYI - I finally solved my problem. What I really wanted was to copy a
named range into a workbook without opening the source.
Taking what I have found on Ron's site, coupled with some creative
stuff found on the board here... I figured that all I really had to
do was come up with a way to write an array formula to my sheet.

Sub loadsheet()
Range("D11:AA11").FormulaArray = "C:MyPath\[File.xls]Sheet1'!
myrangename"
End Sub

I was under the (mistaken) impression that this type of formula needed
an R1C1 type reference, but as it turns out, as long as the range is
defined in the source workbook, you can refer to it in the array of
another workbook. Basically, it's like pasting links, but with a
named range instead of a single cell.

Maybe this is out there somewhere, but everywhere I looked, this
always referenced a single cell or a R1C1 type reference. So anyway,
I'm done...

Rob

 
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
Using variable for range address dr chuck Excel Programming 4 May 26th 06 01:08 AM
getting the absolute range address from a dynamic named range junoon Excel Programming 2 March 21st 06 01:29 PM
Pass a variable into a range? Ian Fleming[_2_] Excel Programming 1 September 7th 05 09:45 AM
How to (re)set a range.value to pass -0- to a "double" variable Dennis Excel Discussion (Misc queries) 2 April 15th 05 11:13 AM
Address of named range pcress Excel Worksheet Functions 3 November 13th 04 08:50 AM


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