AleemAM123
04-11-2008, 07:34 AM
Hi Everyone,
I'm new to this forum and to using VB (no formal training in VB just picked up pieces by experimenting), I usually just record macros rather than write them but I need to do something that requires some programming.
I need to search a row for the letters TI or TRC or FRC (they are part of a word though e.g. 50-TRC-015) and if the letters are not present then I want to delete the entire column.
Saw this code on the site and tried modifying it but I didn't have much success:
Sub LeaveOnlyAEFPOriginal()
Dim test As Boolean, x As Long, lastrow As Long, col As Long
col = ActiveCell.Column
lastrow = Cells(65536, col).End(xlUp).Row
For x = lastrow To 1 Step -1
test = Cells(x, col).Text Like "[AEFPaefp]"
If test = False Then Cells(x, col).EntireRow.Delete
Next
End Sub
Any help would be greatly appreciated, thanks.
I'm new to this forum and to using VB (no formal training in VB just picked up pieces by experimenting), I usually just record macros rather than write them but I need to do something that requires some programming.
I need to search a row for the letters TI or TRC or FRC (they are part of a word though e.g. 50-TRC-015) and if the letters are not present then I want to delete the entire column.
Saw this code on the site and tried modifying it but I didn't have much success:
Sub LeaveOnlyAEFPOriginal()
Dim test As Boolean, x As Long, lastrow As Long, col As Long
col = ActiveCell.Column
lastrow = Cells(65536, col).End(xlUp).Row
For x = lastrow To 1 Step -1
test = Cells(x, col).Text Like "[AEFPaefp]"
If test = False Then Cells(x, col).EntireRow.Delete
Next
End Sub
Any help would be greatly appreciated, thanks.