PC Review


Reply
Thread Tools Rate Thread

accessing named range

 
 
greg
Guest
Posts: n/a
 
      10th Jul 2007
if I have an excel named range. Lets say my_range. and it is the range of
$B$11:$B$51
How can I get the value of the first item?
lets say
B11 = AAA
B12 = BBB
etc....


 
Reply With Quote
 
 
 
 
Bob Phillips
Guest
Posts: n/a
 
      10th Jul 2007
=INDEX(my_range,1)

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"greg" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> if I have an excel named range. Lets say my_range. and it is the range
> of
> $B$11:$B$51
> How can I get the value of the first item?
> lets say
> B11 = AAA
> B12 = BBB
> etc....
>
>



 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      10th Jul 2007
thanks,
but not from a cell. but inside of vba


"Bob Phillips" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> =INDEX(my_range,1)
>
> --
> HTH
>
> Bob
>
> (there's no email, no snail mail, but somewhere should be gmail in my

addy)
>
> "greg" <(E-Mail Removed)> wrote in message
> news:%(E-Mail Removed)...
> > if I have an excel named range. Lets say my_range. and it is the range
> > of
> > $B$11:$B$51
> > How can I get the value of the first item?
> > lets say
> > B11 = AAA
> > B12 = BBB
> > etc....
> >
> >

>
>



 
Reply With Quote
 
Dave Peterson
Guest
Posts: n/a
 
      10th Jul 2007
msgbox worksheets("Sheet999").range("my_Range").cells(1).value



greg wrote:
>
> if I have an excel named range. Lets say my_range. and it is the range of
> $B$11:$B$51
> How can I get the value of the first item?
> lets say
> B11 = AAA
> B12 = BBB
> etc....


--

Dave Peterson
 
Reply With Quote
 
greg
Guest
Posts: n/a
 
      10th Jul 2007
I see this:
Dim rng As Range
Set rng = Worksheets("Sheet1").Range("my_range")
then rng has lots of things:
Value2
formula
but it does not seem like i can use them.
any help?




"greg" <(E-Mail Removed)> wrote in message
news:%(E-Mail Removed)...
> if I have an excel named range. Lets say my_range. and it is the range

of
> $B$11:$B$51
> How can I get the value of the first item?
> lets say
> B11 = AAA
> B12 = BBB
> etc....
>
>



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      10th Jul 2007
Range("my_range").Cells(1,1)

--
---
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)



"greg" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> thanks,
> but not from a cell. but inside of vba
>
>
> "Bob Phillips" <(E-Mail Removed)> wrote in message
> news:(E-Mail Removed)...
>> =INDEX(my_range,1)
>>
>> --
>> HTH
>>
>> Bob
>>
>> (there's no email, no snail mail, but somewhere should be gmail in my

> addy)
>>
>> "greg" <(E-Mail Removed)> wrote in message
>> news:%(E-Mail Removed)...
>> > if I have an excel named range. Lets say my_range. and it is the
>> > range
>> > of
>> > $B$11:$B$51
>> > How can I get the value of the first item?
>> > lets say
>> > B11 = AAA
>> > B12 = BBB
>> > etc....
>> >
>> >

>>
>>

>
>



 
Reply With Quote
 
Alan Beban
Guest
Posts: n/a
 
      10th Jul 2007
Or slightly more efficiently

msgbox Worksheets("Sheet999").Range("my_Range")(1).value

Alan Beban

Dave Peterson wrote:
> msgbox worksheets("Sheet999").range("my_Range").cells(1).value
>
>
>
> greg wrote:
>> if I have an excel named range. Lets say my_range. and it is the range of
>> $B$11:$B$51
>> How can I get the value of the first item?
>> lets say
>> B11 = AAA
>> B12 = BBB
>> etc....

>

 
Reply With Quote
 
Alan Beban
Guest
Posts: n/a
 
      11th Jul 2007
Bob Phillips wrote:
> Range("my_range").Cells(1,1)
>

Slightly more efficiently

Range("my_range")(1,1)

or, for the vertical range proposed

Range("my_range")(1)

Alan Beban
 
Reply With Quote
 
Gary Keramidas
Guest
Posts: n/a
 
      11th Jul 2007

don't know what's more efficient, but just another way

Range("my_range").Range("A1")
--


Gary


"Alan Beban" <unavailable> wrote in message
news:%(E-Mail Removed)...
> Bob Phillips wrote:
>> Range("my_range").Cells(1,1)
>>

> Slightly more efficiently
>
> Range("my_range")(1,1)
>
> or, for the vertical range proposed
>
> Range("my_range")(1)
>
> Alan Beban



 
Reply With Quote
 
Bob Phillips
Guest
Posts: n/a
 
      11th Jul 2007
Yeah, but ugly, ugly, and not worth any performance gain, so I will not be
using it.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"Alan Beban" <unavailable> wrote in message
news:%(E-Mail Removed)...
> Bob Phillips wrote:
>> Range("my_range").Cells(1,1)
>>

> Slightly more efficiently
>
> Range("my_range")(1,1)
>
> or, for the vertical range proposed
>
> Range("my_range")(1)
>
> Alan Beban



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Selecting a named range, the name of the named range is in a cell Luc Microsoft Excel Programming 6 13th Jan 2010 07:35 PM
Accessing a macro created named range John Microsoft Excel Programming 7 5th Feb 2009 04:12 PM
Accessing a sheet-level named range through ADO Ahasverus Microsoft Excel Programming 2 19th Oct 2007 12:15 AM
Accessing data stored in the worksheet (named range) in .xla file =?Utf-8?B?bm9pc2ViZXJn?= Microsoft Excel Programming 1 26th Sep 2007 07:03 PM
inserting a named range into new cells based on a named cell =?Utf-8?B?UGV0ZXIgUy4=?= Microsoft Excel Misc 1 4th Jun 2006 03:53 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 08:03 PM.