Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Define Names / RefersToRange
hi,
i defined a Name "MyName" like =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 in VBA i wrote Dim rng As Range Set rng = ActiveWorkbook.Names("MyName").RefersToRange but the code fails and the RefersToRange is nothing. any idea? -- André Achtermeier ---------------------------------------------- www.appliedtechnologies.de ---------------------------------------------- |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Define Names / RefersToRange
What do you mean by "the code fails" - do you get a run-time error?
Does the line execute, but no assignment take place? Is your name defined as a worksheet-level name? In article , "Andre Achtermeier" wrote: hi, i defined a Name "MyName" like =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 in VBA i wrote Dim rng As Range Set rng = ActiveWorkbook.Names("MyName").RefersToRange but the code fails and the RefersToRange is nothing. any idea? |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Define Names / RefersToRange
I can't reproduce it:
? range("myname").Address(externaL:=True) [Book1]locACTIVE_Template!$P$49,$P$86 ? activeworkbook.Names("MyName").RefersTo =locACTIVE_Template!$P$49,locACTIVE_Template!$P$86 ? activeworkbook.Names("MyName").ReferstoRange.addre ss(external:=True) [Book1]locACTIVE_Template!$P$49,$P$86 set rng = activeWorkbook.Names("MyName").RefersToRange ? rng.Address(external:=True) [Book1]locACTIVE_Template!$P$49,$P$86 Go into Insert=Names and make sure your definition is still good. -- Regards, Tom Ogilvy "Andre Achtermeier" wrote in message ... hi, i defined a Name "MyName" like =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 in VBA i wrote Dim rng As Range Set rng = ActiveWorkbook.Names("MyName").RefersToRange but the code fails and the RefersToRange is nothing. any idea? -- André Achtermeier ---------------------------------------------- www.appliedtechnologies.de ---------------------------------------------- |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Define Names / RefersToRange
Note that I used a comma rather than a semicolon, but since you are in
Germany, a semicolon is probably appropriate. -- Regards, Tom Ogilvy "Andre Achtermeier" wrote in message ... hi, i defined a Name "MyName" like =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 in VBA i wrote Dim rng As Range Set rng = ActiveWorkbook.Names("MyName").RefersToRange but the code fails and the RefersToRange is nothing. any idea? -- André Achtermeier ---------------------------------------------- www.appliedtechnologies.de ---------------------------------------------- |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Define Names / RefersToRange
hi,
thanx for the fast response. =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 is the Range which Excel adds after selecting the cells with "Insert-Names..." when i select only 1 cell everything works fine, but the cells represent 2 different ranges (P49 AND P86) the code fails, because the Range Object from RefersToRange is NOTHING.... "Tom Ogilvy" wrote in message ... Note that I used a comma rather than a semicolon, but since you are in Germany, a semicolon is probably appropriate. -- Regards, Tom Ogilvy "Andre Achtermeier" wrote in message ... hi, i defined a Name "MyName" like =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 in VBA i wrote Dim rng As Range Set rng = ActiveWorkbook.Names("MyName").RefersToRange but the code fails and the RefersToRange is nothing. any idea? -- André Achtermeier ---------------------------------------------- www.appliedtechnologies.de ---------------------------------------------- |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Define Names / RefersToRange
Look at my previous response. I can't duplicate that behavior. It works
fine for me. Try this. With locActive_Template as the active sheet, run this code set rng = Union(range("P49"),range("P86")) rng.name = "MyName" msgbox thisworkbook.Names("MyName").RefersTo Again, that code works for me. -- Regards, Tom Ogilvy "Andre Achtermeier" wrote in message ... hi, thanx for the fast response. =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 is the Range which Excel adds after selecting the cells with "Insert-Names..." when i select only 1 cell everything works fine, but the cells represent 2 different ranges (P49 AND P86) the code fails, because the Range Object from RefersToRange is NOTHING.... "Tom Ogilvy" wrote in message ... Note that I used a comma rather than a semicolon, but since you are in Germany, a semicolon is probably appropriate. -- Regards, Tom Ogilvy "Andre Achtermeier" wrote in message ... hi, i defined a Name "MyName" like =locACTIVE_Template!$P$49;locACTIVE_Template!$P$86 in VBA i wrote Dim rng As Range Set rng = ActiveWorkbook.Names("MyName").RefersToRange but the code fails and the RefersToRange is nothing. any idea? -- André Achtermeier ---------------------------------------------- www.appliedtechnologies.de ---------------------------------------------- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Questions on Define Names | Excel Discussion (Misc queries) | |||
Invalid define names | Charts and Charting in Excel | |||
Define Names in Excel | Excel Discussion (Misc queries) | |||
how to define range names | New Users to Excel | |||
alternate UI for Define Names ?? | Excel Discussion (Misc queries) |