PDA

View Full Version : [SOLVED] Clean the row if column F does not contain UDS or EUR



parscon
09-01-2014, 10:07 AM
Heloo
I need a VBA code that check column F and if it will not find USD or EUR or CAD on this column clean the row also data on column F .i need clean not delete.
thank you

SamT
09-01-2014, 10:51 AM
roughly:
For each Cel in Range("F1:F" & LastRow)
If not (Cel ="USd" OR Cel = EUr" or Cel = "Cad") Then
Cel.EntireRow.ClearContents.

parscon
09-01-2014, 01:05 PM
Dear smaT
I used the below code but does not work


Sub wewe()
For Each Cel In Range("F1:F" & LastRow)
If Not (Cel = "USD" Or Cel = "EUR" Or Cel = "TL") Then
Cel.EntireRow.ClearContents
End If
Next
End Sub

parscon
09-01-2014, 01:16 PM
I used this code and it is work



Sub deleterows()

Dim intcount As Integer
Dim introw As Integer

intcount = ActiveSheet.UsedRange.Rows.Count

For introw = intcount To 1 Step -1
If Not Range("D" & introw) = "USD" Or Range("D" & introw) = "EUR" Or Range("D" & introw) = "CAD" Then
Range("D" & introw).EntireRow.ClearContents
End If

Next

End Sub

SamT
09-01-2014, 01:56 PM
:thumb Excellent work.

Paul_Hossler
09-02-2014, 05:36 PM
Never mind -- had it backwards