![]() |
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! |
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! |
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! |
All times are GMT +1. The time now is 06:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com