Page tree

Welcome to FreeSoftwareServers Confluence Wiki

Skip to end of metadata
Go to start of metadata

https://stackoverflow.com/questions/28804402/search-and-locate-a-column-header-using-excel-vba-macro/59221274#59221274

Function FindHeaderCol(rngHeaderRow, rngHeaderCol) As String
 Set rngHeaderRow = Range(rngHeaderRow)
 Set rngHeaderCol = rngHeaderRow.Find(rngHeaderCol)
 FindHeaderCol = Split(Cells(1, rngHeaderCol.Column).Address, "$")(1)
End Function
Sub Test()
 testcol = FindHeaderCol("1:1", "Test")
 MsgBox testcol
End Sub
  • No labels