steve hill
Board Regular
- Joined
- Jul 11, 2006
- Messages
- 156
- Office Version
- 365
- Platform
- Windows
Hi I am using the code below to delete lines that have no data in columns F to O
as this starts from the possible last row excel will allow it takes a long time to run. Have tried changing the range from A65536 to A10000 but this seemed to lockup the sheet. is there a quicker way of doing this. the sheet has about 7000 lines at this time and grows by upto 500 per month
Sub DELETE_ROWS()
'
For MY_ROWS = Range("A65536").End(xlUp).Row To 2 Step -1
MY_CELL = Range("F" & MY_ROWS).Value & Range("G" & MY_ROWS).Value & Range("H" & MY_ROWS).Value _
& Range("I" & MY_ROWS).Value & Range("J" & MY_ROWS).Value & Range("K" & MY_ROWS).Value _
& Range("L" & MY_ROWS).Value & Range("M" & MY_ROWS).Value & Range("N" & MY_ROWS).Value _
& Range("O" & MY_ROWS).Value
If MY_CELL = "" Then Rows(MY_ROWS).Delete
Next MY_ROWS
'
End Sub
thanks for your time
Steve
as this starts from the possible last row excel will allow it takes a long time to run. Have tried changing the range from A65536 to A10000 but this seemed to lockup the sheet. is there a quicker way of doing this. the sheet has about 7000 lines at this time and grows by upto 500 per month
Sub DELETE_ROWS()
'
For MY_ROWS = Range("A65536").End(xlUp).Row To 2 Step -1
MY_CELL = Range("F" & MY_ROWS).Value & Range("G" & MY_ROWS).Value & Range("H" & MY_ROWS).Value _
& Range("I" & MY_ROWS).Value & Range("J" & MY_ROWS).Value & Range("K" & MY_ROWS).Value _
& Range("L" & MY_ROWS).Value & Range("M" & MY_ROWS).Value & Range("N" & MY_ROWS).Value _
& Range("O" & MY_ROWS).Value
If MY_CELL = "" Then Rows(MY_ROWS).Delete
Next MY_ROWS
'
End Sub
thanks for your time
Steve