G
George
Hi guys, I've looked around at CPearson, OZGrid and Debra's (the name of
which escapes me atm) but I haven't so far found a solution to my problem.
I'm pulling in data from another workbook and then defining named ranges
based on the updated data. This is all working fine as are the lines that
work out the name of the range and the address of the range. Here's the code
I'm using...
dynRangeName = Cells(thisRow, thisCol).Value & depts(thisCol) & "Testers"
Set dynamicRange = Range(Cells(startRow, thisCol + 1), Cells(thisRow,
thisCol + 1))
Debug.Print dynRangeName & " = " & dynamicRange.Address
ThisWorkbook.Names.Add dynRangeName, dynamicRange
The Debug.Print line outputs lines such as these (which are the correct
names and the correct ranges):
ESFncTesters = $B$2:$B$61
LSFncTesters = $B$62:$B$123
NSFncTesters = $B$124:$B$174
My only problem now is that these named ranges that I've added using
"ThisWorkbook.Names.Add" aren't displaying in the Names list (through Insert
Any ideas? I've tried using "Visible:True" on the creation of the names with
no luck. If I create all these names with "rubbish" ranges through the menu
system in Excel when VBA overwrites these names it works, but I didn't really
want to go down this route if I can help it...I don't want to have to rely on
me (or other users) inserting names so the VBA can add them correctly...
Thanks as usual - this forum's been a superb resource for me. Top work you
guys!
George
which escapes me atm) but I haven't so far found a solution to my problem.
I'm pulling in data from another workbook and then defining named ranges
based on the updated data. This is all working fine as are the lines that
work out the name of the range and the address of the range. Here's the code
I'm using...
dynRangeName = Cells(thisRow, thisCol).Value & depts(thisCol) & "Testers"
Set dynamicRange = Range(Cells(startRow, thisCol + 1), Cells(thisRow,
thisCol + 1))
Debug.Print dynRangeName & " = " & dynamicRange.Address
ThisWorkbook.Names.Add dynRangeName, dynamicRange
The Debug.Print line outputs lines such as these (which are the correct
names and the correct ranges):
ESFncTesters = $B$2:$B$61
LSFncTesters = $B$62:$B$123
NSFncTesters = $B$124:$B$174
My only problem now is that these named ranges that I've added using
"ThisWorkbook.Names.Add" aren't displaying in the Names list (through Insert
doesn't work :-(Names > Define...) and as I'm using these NRs for Data Validation, the DV
Any ideas? I've tried using "Visible:True" on the creation of the names with
no luck. If I create all these names with "rubbish" ranges through the menu
system in Excel when VBA overwrites these names it works, but I didn't really
want to go down this route if I can help it...I don't want to have to rely on
me (or other users) inserting names so the VBA can add them correctly...
Thanks as usual - this forum's been a superb resource for me. Top work you
guys!
George