Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Getting the values in a named range

Hi,

I want to list, in the inmediate windows, the values of the named
ranges in my workbook. I prefer, if possible, not having to specify
the worksheet names.

I've tried the following code:

Sub abc()
Dim a
For Each n In Names
Debug.Print n, n.Name
a = n.Value
Debug.Print a
Next
End Sub

I get:

=sdf!$D$6:$D$8 casa
=sdf!$D$6:$D$8
=sdf!$C$12:$D$14 mesa
=sdf!$C$12:$D$14

however I would like something like

=sdf!$D$6:$D$8 casa
1
2
3
=sdf!$C$12:$D$14 mesa
7
8
9

is this possible?

Thank you
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,565
Default Getting the values in a named range

Names are children of the workbook. The refersto: data is to identify where
within the workbook the name is used. That is the basics of the Names
collection. Your part two illustration is confusing, since the debug print
will only provide a predetermined print format.



"vsoler" wrote in message
...
Hi,

I want to list, in the inmediate windows, the values of the named
ranges in my workbook. I prefer, if possible, not having to specify
the worksheet names.

I've tried the following code:

Sub abc()
Dim a
For Each n In Names
Debug.Print n, n.Name
a = n.Value
Debug.Print a
Next
End Sub

I get:

=sdf!$D$6:$D$8 casa
=sdf!$D$6:$D$8
=sdf!$C$12:$D$14 mesa
=sdf!$C$12:$D$14

however I would like something like

=sdf!$D$6:$D$8 casa
1
2
3
=sdf!$C$12:$D$14 mesa
7
8
9

is this possible?

Thank you



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Getting the values in a named range

i use this

Sub name_ranges() ' dumps all named ranges
Dim nm As Name
For Each nm In ThisWorkbook.Names
Debug.Print nm.Name
Next
End Sub

--


Gary Keramidas
Excel 2003


"vsoler" wrote in message
...
Hi,

I want to list, in the inmediate windows, the values of the named
ranges in my workbook. I prefer, if possible, not having to specify
the worksheet names.

I've tried the following code:

Sub abc()
Dim a
For Each n In Names
Debug.Print n, n.Name
a = n.Value
Debug.Print a
Next
End Sub

I get:

=sdf!$D$6:$D$8 casa
=sdf!$D$6:$D$8
=sdf!$C$12:$D$14 mesa
=sdf!$C$12:$D$14

however I would like something like

=sdf!$D$6:$D$8 casa
1
2
3
=sdf!$C$12:$D$14 mesa
7
8
9

is this possible?

Thank you


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 72
Default Getting the values in a named range

misread the post

--


Gary Keramidas
Excel 2003


"Gary Keramidas" wrote in message
...
i use this

Sub name_ranges() ' dumps all named ranges
Dim nm As Name
For Each nm In ThisWorkbook.Names
Debug.Print nm.Name
Next
End Sub

--


Gary Keramidas
Excel 2003


"vsoler" wrote in message
...
Hi,

I want to list, in the inmediate windows, the values of the named
ranges in my workbook. I prefer, if possible, not having to specify
the worksheet names.

I've tried the following code:

Sub abc()
Dim a
For Each n In Names
Debug.Print n, n.Name
a = n.Value
Debug.Print a
Next
End Sub

I get:

=sdf!$D$6:$D$8 casa
=sdf!$D$6:$D$8
=sdf!$C$12:$D$14 mesa
=sdf!$C$12:$D$14

however I would like something like

=sdf!$D$6:$D$8 casa
1
2
3
=sdf!$C$12:$D$14 mesa
7
8
9

is this possible?

Thank you



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 79
Default Getting the values in a named range

On Feb 17, 2:01*am, "JLGWhiz" wrote:
Names are children of the workbook. *The refersto: data is to identify where
within the workbook the name is used. *That is the basics of the Names
collection. *Your part two illustration is confusing, since the debug print
will only provide a predetermined print format.

"vsoler" wrote in message

...

Hi,


I want to list, in the inmediate windows, the values of the named
ranges in my workbook. I prefer, if possible, not having to specify
the worksheet names.


I've tried the following code:


Sub abc()
Dim a
For Each n In Names
* *Debug.Print n, n.Name
* *a = n.Value
* *Debug.Print a
Next
End Sub


I get:


=sdf!$D$6:$D$8 * * * * * * *casa
=sdf!$D$6:$D$8
=sdf!$C$12:$D$14 * * * * * *mesa
=sdf!$C$12:$D$14


however I would like something like


=sdf!$D$6:$D$8 * * * * * * *casa
1
2
3
=sdf!$C$12:$D$14 * * * * * *mesa
7
8
9


is this possible?


Thank you


JLGWhiz,

Thank you for your answer, but if I want to put the values of the
cells in a Variant, how do I do it?
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
Formula Based on Values in Named Range Q Seanie Excel Worksheet Functions 5 January 2nd 12 09:01 PM
Sum values in columns based on values in named range Mikael Andersson Excel Worksheet Functions 10 November 12th 08 09:37 AM
Named range changes values Carole O Excel Discussion (Misc queries) 4 April 24th 07 07:49 PM
Using ADO to INSERT Named Range Values into DB [email protected] Excel Programming 1 March 24th 05 02:29 PM
Iterate through the values in a named range? Brian Excel Programming 1 June 2nd 04 05:04 AM


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