Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() The intent is if a name does not exist to create it. Then set or change the address it points to. I am using the line of code below to change the address that the name points to (when it is created by Insert-Name-Define menus). Names(sFromSheet & aMonths(1) & aYears(i)).RefersTo = "=" & Selection.Address If the name does not exist it stops with an error. ------- When I try to test if the name exists: If Names(sFromSheet & aYears(i)) Then 'Nothing to do it is in existance Else Names.Add sFromSheet & aMonths(1) & aYears(i) End If I get an Application-Defined or ObjectiDefeined Error on the If statement. I get the same error when I add the worksheet name as a preface. If Names(sFromSheet & "!" & sFromSheet & aYears(i)) Then 'Nothing to do it is in existance Else Names.Add sFromSheet & aMonths(1) & aYears(i) End If What am I doing wrong? I am completly lost again! But I am learning! Thanks in advance- Craigm -- Craigm ------------------------------------------------------------------------ Craigm's Profile: http://www.excelforum.com/member.php...o&userid=24381 View this thread: http://www.excelforum.com/showthread...hreadid=537707 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Test if file exists | Excel Discussion (Misc queries) | |||
How to test if a DLL (library) exists | Excel Programming | |||
Test for Worksheet Exists | Excel Programming | |||
Test if a folder exists, create if it doesn't? | Excel Programming | |||
Test if a folder exists | Excel Programming |