the simplest is
sub nameit
cells(7,4).name="whateveryouwanttonameit"
end sub
=whaeveryounamedit
Don Guillett
Microsoft MVP Excel
SalesAid Software
dguille...@gmail.com
-----Original Message-----
From: tangledweb
Sent: Sunday, March 18, 2012 5:22 AM
To: MS EXCEL AND VBA MACROS
Subject: $$Excel-Macros$$ Need help with VBAfor Excel naming and using
column names for looping
I am trying to understand how to name a column of data and be able to
reference the data by that name. Ideally I could set the name
programatically but if it needs to be done through the ribbon command
that is acceptable.
Ideally inserting a new column before the named column will not affect
that column's name.
The simplest example of
=========================
Sub Macro1()
Dim x as long
Const ExitValue = 4
x = Cells(6, ExitValue).Value
Cells(7, ExitValue) = x
End Sub
=======================
Functions but for some reason I can not see the value of x in the
immediate window. I just get nothing back if I print x.
But is this really the best wah to do this? It seems inelegant at
best. And certainly if I insert a new column 3 I need to change this
code to
Const ExitValue = 5
--
FORUM RULES (986+ members already BANNED for violation)
1) Use concise, accurate thread titles. Poor thread titles, like Please
Help, Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will
not get quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security
measure.
4) Acknowledge the responses you receive, good or bad.
5) Cross-promotion of, or links to, forums competitive to this forum in
signatures are prohibited.
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com
--
FORUM RULES (986+ members already BANNED for violation)
1) Use concise, accurate thread titles. Poor thread titles, like Please Help,
Urgent, Need Help, Formula Problem, Code Problem, and Need Advice will not get
quick attention or may not be answered.
2) Don't post a question in the thread of another member.
3) Don't post questions regarding breaking or bypassing any security measure.
4) Acknowledge the responses you receive, good or bad.
5) Cross-promotion of, or links to, forums competitive to this forum in signatures are prohibited.
NOTE : Don't ever post personal or confidential data in a workbook. Forum
owners and members are not responsible for any loss.
------------------------------------------------------------------------------------------------------
To post to this group, send email to excel-macros@googlegroups.com