M
martyn
Hi, I got some excellent code last week from Tom Ogilvy
that
clears some cells if only the first couple are populated
ABCDEFGHIJKLMNOPQRSTU
XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXX
XXX
XXX
XXX
It works great, but what variable do i need to change if i
have a row like
ABCDEFGHIJKLMNOPQRSTU
XXXXXXX XXXXXX
because it is bringing up the information from the cells
below
ABCDEFGHIJKLMNOPQRSTU
XXXXXXXXXXXXXXXXXXXXX
XXXX^^^^^^^^^XXXXXXXX
XXXX XXXXXXXX
the code i use is:
Dim rng As Range, cell As Range
Set rng = Cells(Rows.Count, 1).End(xlUp).Offset(0, 2)
For i = rng.Row To 1 Step -1
Set cell = Cells(i, 4)
cnt = 0
For Each cell1 In cell.Resize(1, 18)
If Len(Trim(cell1.Text)) = 0 Then
cnt = cnt + 1
End If
Next
If cnt = 18 Then
Cells(cell.Row, 1).EntireRow.Delete
End If
that
clears some cells if only the first couple are populated
ABCDEFGHIJKLMNOPQRSTU
XXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXX
XXX
XXX
XXX
It works great, but what variable do i need to change if i
have a row like
ABCDEFGHIJKLMNOPQRSTU
XXXXXXX XXXXXX
because it is bringing up the information from the cells
below
ABCDEFGHIJKLMNOPQRSTU
XXXXXXXXXXXXXXXXXXXXX
XXXX^^^^^^^^^XXXXXXXX
XXXX XXXXXXXX
the code i use is:
Dim rng As Range, cell As Range
Set rng = Cells(Rows.Count, 1).End(xlUp).Offset(0, 2)
For i = rng.Row To 1 Step -1
Set cell = Cells(i, 4)
cnt = 0
For Each cell1 In cell.Resize(1, 18)
If Len(Trim(cell1.Text)) = 0 Then
cnt = cnt + 1
End If
Next
If cnt = 18 Then
Cells(cell.Row, 1).EntireRow.Delete
End If