0

I have a macro in Sheet A. It is running fine when I'm in sheet A but when I'm trying to run it from sheet B, it throws an error.

Sub BP_Clear()
    Dim Lastrow_Data1 As Long
    Dim Lastrow_Pivot1 As Long

    Lastrow_Data1 = Sheets("A").Range("G20000").End(xlUp).row
    Lastrow_Pivot1 = Sheets("A").Range("B20000").End(xlUp).row
    Application.ScreenUpdating = False

    Range("G10").Select
    Selection.End(xlDown).Select
    Range(Cells(10, 7), Cells(Lastrow_Pivot1 + 10000, 7)).ClearContents

    Application.CutCopyMode = False     
End Sub
Mesut Akcan
  • 899
  • 7
  • 19
AVC
  • 1
  • 3

0 Answers0