VBAProIWish
Well-known Member
- Joined
- Jul 6, 2009
- Messages
- 1,027
- Office Version
- 365
- Platform
- Windows
Hello All,
I have code below that deletes any row that has the text value "green" in the "Color" column and it works perfectly. But now I would like to make one modification to it.
Instead of it already having a pre-populated text value in there (in this case, it is currently "green") I would like the code below to get its text value here...
Workbook Name : Cars
Worksheet Name: Large
Cell Position : A2
So, instead of this....
I would like THIS...
Can this be done?
Thanks
I have code below that deletes any row that has the text value "green" in the "Color" column and it works perfectly. But now I would like to make one modification to it.
Instead of it already having a pre-populated text value in there (in this case, it is currently "green") I would like the code below to get its text value here...
Workbook Name : Cars
Worksheet Name: Large
Cell Position : A2
So, instead of this....
Code:
Sub Delete_rows_with_text_x_in_col_x()
Dim cell_to_check As Variant
Dim range_to_check As Range
Dim nCol As Long
Dim rCount As Long
With ActiveSheet
nCol = Application.Match("Color", .Rows(1), 0)
For rCount = .UsedRange.Rows.Count To 2 Step -1
Select Case .Cells(rCount, nCol).Value
Case "[B][SIZE=4][COLOR=red]green[/COLOR][/SIZE][/B]"
.Rows(rCount).EntireRow.Delete
End Select
Next
End With
I would like THIS...
Code:
Sub Delete_rows_with_text_x_in_col_x()
Dim cell_to_check As Variant
Dim range_to_check As Range
Dim nCol As Long
Dim rCount As Long
With ActiveSheet
nCol = Application.Match("Color", .Rows(1), 0)
For rCount = .UsedRange.Rows.Count To 2 Step -1
Select Case .Cells(rCount, nCol).Value
Case "[B][SIZE=4][COLOR=#ff0000]WB=Cars, WS=Large, Cell=A2[/COLOR][/SIZE][/B]"
.Rows(rCount).EntireRow.Delete
End Select
Next
End With
End Sub
Can this be done?
Thanks