Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50103

Delete empty Range R:AA ShiftUp is too slow (3 Minutes)

$
0
0
Hello All,
I'm using below code and it's running too slow apprx. 3minutes. Please help me to make it run faster if possible.

Code:

'''Delete Range R:AA if any S has value = "" (first)'''
    Dim lngMyRow As Long
    lngMyRow = Cells(Rows.Count, "S").End(xlUp).Row + 10
    Range("R" & lngMyRow & ":AA1927").Delete Shift:=xlUp
   
 '''Delete Range R:AA if any X has Value = 0 (second)'''
    lRw = Cells(Rows.Count, "X").End(xlUp).Row
    For lngCounter = lRw To 1 Step -1
        If Cells(lngCounter, "X").Value = "0" Then
            Range(Cells(lngCounter, "R"), Cells(lngCounter, "AA")).Delete Shift:=xlUp
        End If
    Next lngCounter

Regards,
tt3

Viewing all articles
Browse latest Browse all 50103

Trending Articles