genracela
04-19-2010, 12:52 AM
I have a VBA code for deleting data:
Sub DeleteData()
Dim LR As Long
LR = Range("J" & Rows.Count).End(xlUp).Row
On Error Resume Next
Range("J4:J" & LR).SpecialCells(xlBlanks, xlTextValues).EntireRow.Delete
On Error GoTo 0
End Sub
But this code deletes blank rows on this sheet.
What if I want to delete the data on the other sheet?
I tried modifying the formula but this doesn't work.
Sub DeleteData()
Dim LR As Long
Sheets("sheet2").LR = Range("J" & Rows.Count).End(xlUp).Row
On Error Resume Next
Range("J4:J" & LR).SpecialCells(xlBlanks, xlTextValues).EntireRow.Delete
On Error GoTo 0
End Sub
Please help.
Sub DeleteData()
Dim LR As Long
LR = Range("J" & Rows.Count).End(xlUp).Row
On Error Resume Next
Range("J4:J" & LR).SpecialCells(xlBlanks, xlTextValues).EntireRow.Delete
On Error GoTo 0
End Sub
But this code deletes blank rows on this sheet.
What if I want to delete the data on the other sheet?
I tried modifying the formula but this doesn't work.
Sub DeleteData()
Dim LR As Long
Sheets("sheet2").LR = Range("J" & Rows.Count).End(xlUp).Row
On Error Resume Next
Range("J4:J" & LR).SpecialCells(xlBlanks, xlTextValues).EntireRow.Delete
On Error GoTo 0
End Sub
Please help.