Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Column name

Status
Not open for further replies.

muimui

MIS
Sep 27, 2001
5
CA
I am just wondering if there is any easy way to find out the column name.
I'm trying to populate a validation list in wkA from another worksheet (eg wkB) (which I dont' think it'll work, however, if you know how it'll work let me know) and I copied the list and transpose it on a row on wkA. However, i know what the end of the row is but need the name of the column to reference it correctly. Anyone?
 
Hi muimui,

I'm not exactly sure what you want to do. Here are a few comments though:

To get the column if you have a specific cell you can use:

myCell.EntireColumn

myCell beign any range expression. But I noticed that the result of myCell.EntireColumn.Name will be something like "=Sheet1!$E:$E" even if the column has got a name. One way round is something like the following:

Code:
...
Dim x As Name
Dim myCell as Range

Set myCell = ...
    
For Each x In Names
    If x.RefersTo = myCell.EntireColumn.Name Then
        MsgBox x.Name
    End If
Next x
...
[\code] 

It looks very long winded to me but it should work.

Hope this helps,

Nath
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top