Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Validating range names

I have a program that I am trying to debug. An error occurs when
trying to name a range using a string that "looks" like a cell
reference or formula.

For example, I can name my range "abc123", but not "ab12". No string
beginning with a numeral can be used. Also, "a" works, "b" works, but
not "c".


Does anyone have a snippet of code that validates strings for use as
range names?


Thanks!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Validating range names

One way

Dim nme As Name

On Error Resume Next
Set nme = ActiveWorkbook.Names.Add(Name:="P1", _
RefersTo:="'" & ActiveSheet.Name & "'!A1:A10")
On Error GoTo 0
If nme Is Nothing Then
MsgBox "Invalid name"
End If


--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"procreator" wrote in message
oups.com...
I have a program that I am trying to debug. An error occurs when
trying to name a range using a string that "looks" like a cell
reference or formula.

For example, I can name my range "abc123", but not "ab12". No string
beginning with a numeral can be used. Also, "a" works, "b" works, but
not "c".


Does anyone have a snippet of code that validates strings for use as
range names?


Thanks!



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,593
Default Validating range names

BTW, don't forget ABC123 may be valid in Excel 2003, but it isn't in Excel
2007 with its 16K columns.

--
HTH

Bob

(there's no email, no snail mail, but somewhere should be gmail in my addy)

"procreator" wrote in message
oups.com...
I have a program that I am trying to debug. An error occurs when
trying to name a range using a string that "looks" like a cell
reference or formula.

For example, I can name my range "abc123", but not "ab12". No string
beginning with a numeral can be used. Also, "a" works, "b" works, but
not "c".


Does anyone have a snippet of code that validates strings for use as
range names?


Thanks!



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
converting email address names in a range of cells to real names John Excel Worksheet Functions 1 May 19th 10 03:44 PM
How to Delete blanks between a range and populate only the names inthe given range Yuvraj Excel Discussion (Misc queries) 2 November 4th 09 08:32 PM
COPYING FORMULA CONTAINING NAMES/RELATIVE RANGE NAMES Bricol Excel Discussion (Misc queries) 0 July 8th 08 03:54 PM
Selecting range in list of range names depending on a cell informa Courreges Excel Discussion (Misc queries) 2 June 19th 06 10:59 AM
Range Names Rich Cooper Excel Programming 2 May 22nd 04 05:15 PM


All times are GMT +1. The time now is 08:26 PM.

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"