Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Trying to get this piece of code to compile. All I want to
do is to cycle through the range names in a workbook and assign details to some variables. It bugs out though... Dim nm as object For Each nm In ActiveWorkbook.Names rng_name = nm.Name // this works ok rng_sheet = nm.Worksheet.Name // this bugs out rng_add = nm.Address // this also bugs out Next nm Any help much appreciated Chris |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Dim rng as Range
Dim nm as Name Dim rng_sheet as String Dim rng_add as String Dim nm as Name For Each nm In ActiveWorkbook.Names rng_name = nm.Name '// this works ok On Error Resume Next set rng = nm.RefersToRange On Error goto 0 if not rng is nothing then rng_sheet = rng.parent.Name '// this bugs out rng_add = rng.Address '// this also bugs out ' or 'rng_add = nm.Refersto else rng_sheet = "" rng_add = "" end if Next nm Regards, Tom Ogilvy Note that you can have defined names that don't refer to ranges. That is what the error checking is all about. -- Regards, Tom Ogilvy Chris Gorham wrote in message ... Trying to get this piece of code to compile. All I want to do is to cycle through the range names in a workbook and assign details to some variables. It bugs out though... Dim nm as object For Each nm In ActiveWorkbook.Names rng_name = nm.Name // this works ok rng_sheet = nm.Worksheet.Name // this bugs out rng_add = nm.Address // this also bugs out Next nm Any help much appreciated Chris |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro to update a column in a work based on another work sheet | New Users to Excel | |||
how can i automatically generate work order numbers from work orde | Excel Discussion (Misc queries) | |||
flash object dont work in my excel work sheet | Excel Discussion (Misc queries) | |||
Counting dates in multiple work sheets and work books | Excel Discussion (Misc queries) | |||
Is there away to keep "auto save" from jumping to the first work sheet in the work book? | New Users to Excel |