General Ledger
Active Member
- Joined
- Dec 31, 2007
- Messages
- 460
Dear All,
In a macro using Excel 2010, I am looking for code that finds certain column labels and deletes those columns.
Something like, find the column labels "Date of Birth" and "SSN" in row 1 and delete the entire columns. If a desired label does not exist, continue on to search for the next label. After all the labels have been searched for, simply end.
I have found some code to get me close but am not sure how to delete the correct column or if this is really the best approach.
Thanks,
GL
In a macro using Excel 2010, I am looking for code that finds certain column labels and deletes those columns.
Something like, find the column labels "Date of Birth" and "SSN" in row 1 and delete the entire columns. If a desired label does not exist, continue on to search for the next label. After all the labels have been searched for, simply end.
I have found some code to get me close but am not sure how to delete the correct column or if this is really the best approach.
Code:
For Each Word In Array("Date of Birth, "SSN")
Set aRange = Range("a1:iv1").Find(What:=Word, LookAt:=xlWhole, MatchCase:=False)
If aRange Is Not Nothing Then
?code to delete the entire column?
End If
Next Word
Thanks,
GL