I have run this code from the sheet("dataeachstore") and the data is emptied in the desired ranges. However, if I copy the code to another sheet("dashboard"} and put it in command button 1 in the "dashboard", and command button 1 is run, the data is not deleted. The msgbox's do display, so the program is going through the With/End With path, but the data is not deleted. It seems that the code runs but the sheet "DATASHEET" is not active or is not being accessed.
I guess I need code that I can , while being in a workbook/worksheet - go to another workbook/worksheet and do something and return to the initial workbook/worksheet.
Thanks Carroll
Private Sub CommandButton1_Click()
With Workbooks("BEST_TEMPLATE_for_FINAL_REPORT_Ver_20_DATA_ALL_STORES.xlsm").Sheets("DATAEACHSTORE")
' EMPTYS THE QUERY DATA FOR EACH STORE - READY FOR NEW QUERY DATA
'EMPTY RICHARDSON QUERY DATA
Range("AZ6:BG3000").Select
Selection.Clear
Selection.Clear
Range("AZ6:BG6").Select
MsgBox "RICHARDSON QUERY DATA DELETED ", , "Example"
'EMPTY DALLAS QUERY DATA
Range("BV6:CC3000").Select
Selection.Clear
Selection.Clear
Range("BV6:CC6").Select
MsgBox "DALLAS QUERY DATA DELETED ", , "Example"
'EMPTY FRISCO QUERY DATA
Range("CR6:CY3000").Select
Selection.ClearContents
Selection.ClearFormats
Range("CR6:CY6").Select
MsgBox "FRISCO QUERY DATA DELETED ", , "Example"
'EMPTY McKINNEY QUERY DATA
Range("DN6:DU3000").Select
Selection.ClearContents
Selection.ClearFormats
Range("DN6:DU6").Select
MsgBox "McKINNEY QUERY DATA DELETED ", , "Example"
End With
End Sub