excelninja
New Member
- Joined
- Apr 19, 2012
- Messages
- 19
Hi
I am trying to run the loop below to find any blank cell in column Q, starting at Row 10 and looping until the lastrow with contents. When there is a blank cell, I want to clear the contents of the cell from column Q to column AM. Any help would be great.
Sub ClearEmptyRows()
Dim xSheet As Worksheet
Dim i As Integer
Set xSheet = Sheets("Sector")
xSheet.Select
For i = 10 To xSheet.Range("Q" & 65000).End(xlUp).Row
If xSheet.Range("Q" & i).Value = "" Then
xSheet.Range("Q" & i & ":" & "AM" & i).Clear
End If
Next
End Sub
I am trying to run the loop below to find any blank cell in column Q, starting at Row 10 and looping until the lastrow with contents. When there is a blank cell, I want to clear the contents of the cell from column Q to column AM. Any help would be great.
Sub ClearEmptyRows()
Dim xSheet As Worksheet
Dim i As Integer
Set xSheet = Sheets("Sector")
xSheet.Select
For i = 10 To xSheet.Range("Q" & 65000).End(xlUp).Row
If xSheet.Range("Q" & i).Value = "" Then
xSheet.Range("Q" & i & ":" & "AM" & i).Clear
End If
Next
End Sub