range.createnames method

D

DaveL

I'm trying to use the method to create names for columns in "Myrange" with
the statement: Myrange.createnames Top:=True. It doesn't seem to execute
properly. First, it won't execute until I answer the question "Do you want
to redefine 'TDA'? TDA is the first entry in the second row first column,
and I have to answer the question for each entry in the first column of every
row. After I do that it executes and all the columns get named as expected,
except the first column. The name for the first column appears in the name
manager list but it is the original range less the first row and the first
column--it is supposed to be just the first column. Also a lot of the first
column entries end up in the name manager list and are names for their entire
row. Does anyone have any experience with this method and know whether it
works properly.
 
J

Jim Rech

You can suppress the prompt with this: Application.DisplayAlerts = False

I don't follow you exactly on the problem with the resulting range names but
if you get the right result manually you might try recording a macro as you
do it and then replace "Selection" in the resulting code with the exact
range, e.g., Range("A1:D4").CreateNames Top:=True. This would result in
names being created for the ranges A2:A4, B2:B4, etc.

--
Jim
| I'm trying to use the method to create names for columns in "Myrange" with
| the statement: Myrange.createnames Top:=True. It doesn't seem to execute
| properly. First, it won't execute until I answer the question "Do you
want
| to redefine 'TDA'? TDA is the first entry in the second row first column,
| and I have to answer the question for each entry in the first column of
every
| row. After I do that it executes and all the columns get named as
expected,
| except the first column. The name for the first column appears in the
name
| manager list but it is the original range less the first row and the first
| column--it is supposed to be just the first column. Also a lot of the
first
| column entries end up in the name manager list and are names for their
entire
| row. Does anyone have any experience with this method and know whether it
| works properly.
 
D

DaveL

Jim,

Thanks! Did the manual approach from a worksheet and it worked fine,
including the first row. However, first I had to delete all the names in the
name manager list that were referred to that range. After I did that there
were no prompts and the first row did get named properly.. When I did it
manually I notice that the default for "Left" was "True" as was "Top". All
others were false. That could have been the reason some of the rows were
named by the left column--I needed to set "Left" to "false". Anyway, I'm
convinced it work and Ill play with it in VBA language to see what needs to
be set/deleted to make it work that way.

Dave
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top