vijkar2008
New Member
- Joined
- Feb 9, 2022
- Messages
- 3
- Office Version
- 365
- Platform
- Windows
Hi,
I am looking for a partial match syntax for array. I have declared array as the following - column names of a consolidated sheet:
arrCurrentColumnNames = Array("State", "Line of Business", "Tracking Numbers")
I am using the below loop to write the headers. How do I change this below code to make the loop look for partial match of these headers in the array and use it for the rest of my macro?
For ex: Array has 'State' and the column of data sheet has 'Two Digit State'. I still want the macro to get the values from 'Two Digit State' column and paste it under 'State' in the destination sheet.
'Write headers
For numColumnCounter = 0 To UBound(arrCurrentColumnNames)
'If InStr(1, arrCurrentColumnNames(numColumnCounter), vbTextCompare) > 0 Then
ThisWorkbook.Sheets("Consolidated").Cells(1, numColumnCounter + 1).Value = arrCurrentColumnNames(numColumnCounter)
'End If
Next
The above loop is just one where I want to do partial match of array value. Any help is much appreciated. Thanks in advance!
I am looking for a partial match syntax for array. I have declared array as the following - column names of a consolidated sheet:
arrCurrentColumnNames = Array("State", "Line of Business", "Tracking Numbers")
I am using the below loop to write the headers. How do I change this below code to make the loop look for partial match of these headers in the array and use it for the rest of my macro?
For ex: Array has 'State' and the column of data sheet has 'Two Digit State'. I still want the macro to get the values from 'Two Digit State' column and paste it under 'State' in the destination sheet.
'Write headers
For numColumnCounter = 0 To UBound(arrCurrentColumnNames)
'If InStr(1, arrCurrentColumnNames(numColumnCounter), vbTextCompare) > 0 Then
ThisWorkbook.Sheets("Consolidated").Cells(1, numColumnCounter + 1).Value = arrCurrentColumnNames(numColumnCounter)
'End If
Next
The above loop is just one where I want to do partial match of array value. Any help is much appreciated. Thanks in advance!