View Single Post
 
Old 03-10-2012, 02:05 AM
macropod's Avatar
macropod macropod is offline Windows 7 64bit Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 22,385
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

You could try something along the lines of:
Code:
Sub Demo()
Dim LastCol As Long, i As Long
With ActiveSheet
  LastCol = .Cells.SpecialCells(xlCellTypeLastCell).Column
  For i = 1 To LastCol
    If .Cells(1, i).Value = "Price" Then Exit For
  Next
  MsgBox Split(.Cells(1, i).Address, "$")(1)
End With
End Sub
Of course, you don't actually need the column letter(s) to work with the column. Having found the column number, you can work with that. For example, if you want a value from the 10th row in the found column, you could use:
.Cells(10, i).Value
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote