Tuesday, 26 March 2013

How To Search in a Dynamic Column in Excel

Excel VBA Macro To Find a Dynamic Column Name
Sub Dynamic_Column_Search()
Dim Col_Search As String
Dim TargetColumn As Range

Col_Search = "Consol_Data" 'Dynamic Column Name That you want Search or Find

Set TargetColumn = ActiveSheet.Rows(1).Find(What:=Col_Search, LookIn:=xlValues, _

    LookAt:=xlWhole, SearchOrder:=xlByColumns, SearchDirection:=xlNext, _
    MatchCase:=False, SearchFormat:=False)

If Not TargetColumn Is Nothing Then

        MsgBox "Target Column Found At  " & TargetColumn.Address & _
        " and the Targe Column Number is " & TargetColumn.Column
MsgBox "TargetColumn Not Found"
End If
End Sub

No comments:

Post a Comment

Hi User, Thank You for Visiting My Blog. Please Post Your Feedback/Comments/Query.

Subscribe to Blog Posts by Email

ExcelKingdom-Popular Posts

ExcelKingdom-Random Posts