I am using below code to clear the content from A2 cell till last. this code working fine if the active sheet is TimeStampWork. But If I on any other sheet, I am getting Error 1004, Method 'Range' of object '_Worksheet' failed error. How can I run the same code eventhough sheet is not active ?
Sub test1()
Dim ForClr As Worksheet
Set ForClr = Workbooks("Main.xlsm").Sheets("TimeStampWork")
ForClr.Range("A2", Range("A2").End(xlDown)).ClearContents
End Sub