Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 12
Default Adding and deleting Range Names

I tried to write code that when a certain value is found
in a cell, that cell gets a range name VALUE1 that I can
return to later via: Range("VALUE1").Select. The next time
such a cell is found, VALUE1 is deleted from the name list
and re-applied to the new cell. This would enable me to
dynamically mark certain locations.

As a test, I wrote this:

Names.Add Name:="XXAA", RefersTo:="=Sheet1!A1"
Range("XXAA").Select

This doesn't work. Line 2 crashes.

Any insights appreciated
Paul




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 109
Default Adding and deleting Range Names

Your code works OK for me (XL97 NT4). Your code is a bit "lazy" in
omitting some Parent detail, but this should not be much of a problem
here.

1. I assume that you do, in fact, have a sheet named Sheet1.
2. To make a selection the sheet must be the active one.
3. Application.Goto is often better than Select (one line of code).
4. You may not need to Select the range anyway if you just want to
access its data. eg. MyValue =
Worksheets("Sheet1").Range("XXAA").Value

Try :-
ActiveWorkbook.Names.Add Name:="XXAA", RefersTo:="=Sheet1!A1"
Worksheets("Sheet1").Activate
Worksheets("Sheet1").Range("XXAA").Select


Regards
BrianB
=======================================


"Paul" wrote in message ...
I tried to write code that when a certain value is found
in a cell, that cell gets a range name VALUE1 that I can
return to later via: Range("VALUE1").Select. The next time
such a cell is found, VALUE1 is deleted from the name list
and re-applied to the new cell. This would enable me to
dynamically mark certain locations.

As a test, I wrote this:

Names.Add Name:="XXAA", RefersTo:="=Sheet1!A1"
Range("XXAA").Select

This doesn't work. Line 2 crashes.

Any insights appreciated
Paul

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Deleting invisible range names - how? Kevryl Excel Discussion (Misc queries) 3 June 2nd 10 06:27 AM
Restoring formulas after deleting range names KDJ Excel Worksheet Functions 3 January 2nd 07 06:24 PM
deleting worksheets from names in a range Jenn Excel Discussion (Misc queries) 2 August 23rd 05 12:00 AM
adding range names SheriTingle Excel Discussion (Misc queries) 2 July 12th 05 03:52 PM
Adding Range Names John Excel Worksheet Functions 1 January 18th 05 11:56 AM


All times are GMT +1. The time now is 05:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"