Advertisement
Guest User

Untitled

a guest
Jun 25th, 2019
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. Dim sheet As Worksheet
  2. Set sheet = Sheets(SheetName)
  3.  
  4. strSearch = ColumnName
  5.  
  6. Set aCell = sheet.Rows(1).Find(What:=strSearch, LookIn:=xlValues, _
  7. LookAt:=xlWhole, SearchOrder:=xlByRows, SearchDirection:=xlNext, _
  8. MatchCase:=False, SearchFormat:=False)
  9.  
  10. If Not aCell Is Nothing Then
  11. GetColumnAddress = aCell.Address
  12. Else
  13. GetColumnAddress = "$A$1" 'Error!
  14. End If
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement