CuriousGeorge2
Technical User
I have written a macro, which runs fine when I either go to tools>>>macros and run it from there, or if I assign it to a toolbar button.
But if I put a button on the spreadsheet itself and assign this code to the button, it errors out on the command
Range("A4").Select
What's wrong with that command? It works fine if I run the macro, but not when I click the button it's assigned to?
Range("A3:J17").Select
Selection.Copy
Sheets("INSTALL").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Columns.AutoFit
Range("A3").Select
Sheets("SUMMARY").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("INSTALL").Select
Application.CutCopyMode = False
ChDir "N:\DISCONNECTS\PENDING\9568\Archive"
ActiveWorkbook.SaveAs Filename:= _
"N:\DISCONNECTS\PENDING\9568\Archive\MOC_INSTALLS.xls", FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False
But if I put a button on the spreadsheet itself and assign this code to the button, it errors out on the command
Range("A4").Select
What's wrong with that command? It works fine if I run the macro, but not when I click the button it's assigned to?
Range("A3:J17").Select
Selection.Copy
Sheets("INSTALL").Select
Range("A4").Select
Selection.PasteSpecial Paste:=xlValues, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.PasteSpecial Paste:=xlFormats, Operation:=xlNone, SkipBlanks:= _
False, Transpose:=False
Selection.Columns.AutoFit
Range("A3").Select
Sheets("SUMMARY").Select
ActiveWindow.SelectedSheets.Visible = False
Sheets("INSTALL").Select
Application.CutCopyMode = False
ChDir "N:\DISCONNECTS\PENDING\9568\Archive"
ActiveWorkbook.SaveAs Filename:= _
"N:\DISCONNECTS\PENDING\9568\Archive\MOC_INSTALLS.xls", FileFormat:=xlNormal _
, Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False