S
sloth
On my spreadsheet I have a dynamic named range (OutputNames) which has
as values the names of other defined names in my worksheet. I want to
loop thru OutputNames and for each defined name, write all its contents
in a column. Below is the code I've written so far, but it doesn't
seem to work. All it does is write the names of the defined names in
OutputNames, where what I really want it to do is print the values.
So for example, if OutputNames had two defined names, Revenue and
Expense. And Revenue had values 10, 20, 30, and Expense had values
1,2,3, I would want the sub routine when called to write:
10
20
30
1
2
3
This is the first piece of code I've tried to write, so please any help
is appreciated:
Dim rngOutputNames as Range, rngName as Range, oCell as Range
Dim r as Integer, c as Integer
Set rngOutputNames = Range(Application.Names!OutputNames)
Range("B5").Select
For Each rngName In rngOutputNames
For Each oCell In rngName
ActiveCell.Offset(r, c).Value = oCell
r = r + 1
Next
Next
as values the names of other defined names in my worksheet. I want to
loop thru OutputNames and for each defined name, write all its contents
in a column. Below is the code I've written so far, but it doesn't
seem to work. All it does is write the names of the defined names in
OutputNames, where what I really want it to do is print the values.
So for example, if OutputNames had two defined names, Revenue and
Expense. And Revenue had values 10, 20, 30, and Expense had values
1,2,3, I would want the sub routine when called to write:
10
20
30
1
2
3
This is the first piece of code I've tried to write, so please any help
is appreciated:
Dim rngOutputNames as Range, rngName as Range, oCell as Range
Dim r as Integer, c as Integer
Set rngOutputNames = Range(Application.Names!OutputNames)
Range("B5").Select
For Each rngName In rngOutputNames
For Each oCell In rngName
ActiveCell.Offset(r, c).Value = oCell
r = r + 1
Next
Next