PDA

View Full Version : [SOLVED] Clean the row if column B to O is empty



parscon
07-17-2014, 05:15 AM
I need a VBA that check each row from column B to Column O and if cannot find any data clean that row
just it is important i need clean the content of that row not delete it.

Thank you for your big help.

mancubus
07-17-2014, 07:08 AM
i assume you want to clear data in Columns A, P, Q, R....




Sub ClearContentsBasedOnCondition()

Dim i As Long
With Worksheets("Sheet1") 'change worksheet name to suit
For i = 2 To .Cells.Find("*", , , , xlByRows, xlPrevious).Row
If Application.CountA(.Range("B" & i & ":O" & i)) = 0 Then .Rows(i).ClearContents
Next
End With
End Sub

parscon
07-17-2014, 07:30 AM
Dear mancubus, thank you very much , really you saved my time.

mancubus
07-17-2014, 07:31 AM
you are welcome.

thanks for the feedback.