I think its this line that may not be populating
strJobNbr = Worksheets("Data").Range("JOB_NO").Text
Check for a value in strJobNbr
What happens if you remove the .text
Regards Ralph
----- Reply message -----
From: "Hafizullah" <hafizullah@aol.com>
To: <ExcelVBA@yahoogroups.com>
Subject: [ExcelVBA] Naming a Range from a variable
Date: Fri, Jun 21, 2013 7:33 am
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 (1) |
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