Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub CheckInitials()
Dim lngRow As Long Dim lngLastRow As Long Dim intCol As Integer Dim intCounter As Integer 'Here you will need to use a column 'that will ALWAYS contain a value -- 'at least in the very last row 'I have used A in my example lngLastRow = ActiveSheet.Range("A65536").End(xlUp).Row For lngRow = lngLastRow To 1 Step -1 For intCounter = 16 To 20 If Trim(Cells(lngRow, intCounter).Value) = "MS" Then Rows(lngRow).EntireRow.Delete Exit For End If Next intCounter Next lngRow End Sub -- HTH, Dianne In , Gareth typed: I want to check a range (P:T) in every row. These cells will contain 2 letter codes, if the code 'MS' is found ON ITS OWN then I want to delete that row. The number of rows on the sheet will vary. Examples: MS TG do not delete MS delete no codes at all do not delete BB DD FG TR do not delete Thanks in advance. Gareth |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Check for empty range in vba | Excel Discussion (Misc queries) | |||
Q: check a range values | Excel Discussion (Misc queries) | |||
can a formula check for a certain value in a range? | Excel Discussion (Misc queries) | |||
How to check cells in a range for a value | Excel Programming | |||
check if range containing values | Excel Programming |