Hi,
I'm running below VBA code and getting overflow error. Please help
[Code]
Sub Clear_Sheet()
Application.ScreenUpdating = False
Dim msg As Integer
Dim LastRow1 As Integer
Dim LastRow As Integer
Sheets("Consolidated Data").Select
'On Error Resume Next
Range("A1").Select
LastRow = ActiveSheet.Cells(Rows.Count, 1).End(xlUp).Row // Error at this line/////
If WorksheetFunction.CountA(Range("A2:Q1048576")) > 0 Then
Range("A2:Q" & LastRow).Select
Selection.EntireRow.Delete
msg = MsgBox("Old Data Cleared from Consolidation sheet", vbOKOnly, "Success! Consolidation Report")
ActiveWorkbook.Save
Else
msg = MsgBox("No Data to Delete in Consolidaton sheet", vbInformation, "Consolidation Report")
Range("A2").Select
End Sub
[Code]
Bookmarks