ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   cell clearance (https://www.excelbanter.com/excel-programming/277958-cell-clearance.html)

fred

cell clearance
 
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


The code i have is great, but i
thought it would only delete a row if EVERY cell after D
was empty. I do have some cells however which
are filled to D, then some blank, then the rest
filled. What the current code does tho is delete the
inbetween gaps, and move the information up from below so
that the row that genuinely has less information is now
fully populated and therefore now wrong.
To summarise then, i need to delete any
cells as per the current code, but not if there is a gap G-
O(inclusive) because a few entries have less information
than others. Is that feasible?



All times are GMT +1. The time now is 09:31 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com