I want my macro to loop through a series of files and, if all the cells B10:F10 in Sheet2 are empty, then delete row 10.
I think my problem is that the value in each cell is linked from Sheet1 and the zero for an empty field is hidden (e.g. ='Sheet1'!B22 & ""); I have tried to delete for both Cell.Value = " " and "0" without success.
The loop runs OK. If I set Cell.Value = "", then it deletes row 10 regardless of whether the fields are empty or not.
Guidance very gratefully received!
I think my problem is that the value in each cell is linked from Sheet1 and the zero for an empty field is hidden (e.g. ='Sheet1'!B22 & ""); I have tried to delete for both Cell.Value = " " and "0" without success.
The loop runs OK. If I set Cell.Value = "", then it deletes row 10 regardless of whether the fields are empty or not.
Guidance very gratefully received!
Code:
Dim found As Boolean
found = False
Sheets("Sheet2").Select
For Each cell In Range("B10:F10").Cells
If cell.Value = " " Then
found = True
End If
Next
If found = True Then
Rows(10).EntireRow.Delete Shift:=xlUp
End If