Hi,
I am trying to use below code to autofilter the data in an Excel sheet. But, I have 2 columns with same name i-e 'Labels' in an excel.
When I use below code, it always refer the first occurrence of the 'Label' column and ignore the other one.
Can anyone help me here please? I am new to VBA so not able to figure out the correct way.
Many thanks in advance!!!!!
Dim p As Integer, rngData7 As Range
Set rngData7 = Range("A1").CurrentRegion
p = Application.WorksheetFunction.Match("Labels", Range("A1:ZA1"), 0)
rngData7.AutoFilter p, Array("IMP", "BLB", "CTP", "KTLO", "REG", "MaintenanceRR", "OnTopOf", "Prior", "T1", "T2", "="), xlFilterValues
Dim p1 As Integer, rngData77 As Range
Set rngData77 = Range("A1").CurrentRegion
p1 = Application.WorksheetFunction.Match("Labels", Range("A1:ZA1"), 0)
rngData77.AutoFilter p1, Array("IMP", "BLB", "CTP", "KTLO", "REG", "MaintenanceRR", "OnTopOf", "Prior", "T1", "T2", "="), xlFilterValues
I am trying to use below code to autofilter the data in an Excel sheet. But, I have 2 columns with same name i-e 'Labels' in an excel.
When I use below code, it always refer the first occurrence of the 'Label' column and ignore the other one.
Can anyone help me here please? I am new to VBA so not able to figure out the correct way.
Many thanks in advance!!!!!
Dim p As Integer, rngData7 As Range
Set rngData7 = Range("A1").CurrentRegion
p = Application.WorksheetFunction.Match("Labels", Range("A1:ZA1"), 0)
rngData7.AutoFilter p, Array("IMP", "BLB", "CTP", "KTLO", "REG", "MaintenanceRR", "OnTopOf", "Prior", "T1", "T2", "="), xlFilterValues
Dim p1 As Integer, rngData77 As Range
Set rngData77 = Range("A1").CurrentRegion
p1 = Application.WorksheetFunction.Match("Labels", Range("A1:ZA1"), 0)
rngData77.AutoFilter p1, Array("IMP", "BLB", "CTP", "KTLO", "REG", "MaintenanceRR", "OnTopOf", "Prior", "T1", "T2", "="), xlFilterValues