Hi All,
I have varying blocks of data that cover columns A to G with blocks of hours in column D. I have added 2 blank rows to separate the projects, and a sum for each block of hours for any single project in column E, within the first blank row I added. I now need to delete any range where the sum I've added is < 25, but not sure best approach for this to make sure it deletes that block of data.
I tried the below however it only deletes the hours within column D rather that the range.
any help would be appreciated
I have varying blocks of data that cover columns A to G with blocks of hours in column D. I have added 2 blank rows to separate the projects, and a sum for each block of hours for any single project in column E, within the first blank row I added. I now need to delete any range where the sum I've added is < 25, but not sure best approach for this to make sure it deletes that block of data.
I tried the below however it only deletes the hours within column D rather that the range.
VBA Code:
Sub DeleteProjects()
'adds sum formula for all engineers projects
Dim rng As Range
Dim Str As String
For Each rng In Range("D2", Range("D" & Rows.Count).End(xlUp)).SpecialCells(xlConstants).Areas
With rng.Offset(rng.Count + 1, 1).Resize(1)
If rng.Value < 25 Then rng.Delete
End With
Next rng
End Sub
any help would be appreciated