I figured it out.
A range name cannot begin with a digit. "000001" as the contents of
strJobNbr fails. "_000001" works just fine.
Thx to all for your help.
Hafizullah
@}->-`-,---
--- In ExcelVBA@yahoogroups.com, "Hafizullah" wrote:
>
> Using VBA, I want to assign a name to a range, using a variable set
from
> the contents of one of the cells in the range. Right now, the variable
> is a string.
>
> strJobNbr = Worksheets("Data").Range("JOB_NO").Text
> When I go to give my range a name from this variable
> Range("C4:R9").Name = strJobNbrit raises
> Run-time Error "1004" Application-defined or object-defined error
> When I use an arbitrary name embedded in quotes, it executes without a
> problem.
> What's going on here?
> ~Hafizullah
>
>
> [Non-text portions of this message have been removed]
>
[Non-text portions of this message have been removed]
Reply via web post | Reply to sender | Reply to group | Start a New Topic | Messages in this topic (3) |
Be sure to check out TechTrax Ezine for many, free Excel VBA articles! Go here: http://www.mousetrax.com/techtrax to enter the ezine, then search the ARCHIVES for EXCEL VBA.
----------------------------------
Visit our ExcelVBA group home page for more info and support files:
http://groups.yahoo.com/group/ExcelVBA
----------------------------------
More free tutorials and resources available at:
http://www.mousetrax.com
----------------------------------
Tidak ada komentar:
Posting Komentar