Hi all
I recorded a macro to copy an existing worksheet into a new workbook, and assigned this to an existing button (form control) with text displayed as 'export report'. Once the duplicated worksheet is created in the new workbook the macro is also supposed to remove the button from the newly created copy. However, whats actually happening is that it only worked for the first button as its looking for "Button 1", but thats not the real issue. The real issue is that when the copy is made the original button in the original document no longer has the macro assigned to it?
My code is as follows:
I'm not sure what i'm doing wrong. Might it be that I have to change the order of how i'm doing something, or when I assign the macro to the button?
Thanks in advance!
I recorded a macro to copy an existing worksheet into a new workbook, and assigned this to an existing button (form control) with text displayed as 'export report'. Once the duplicated worksheet is created in the new workbook the macro is also supposed to remove the button from the newly created copy. However, whats actually happening is that it only worked for the first button as its looking for "Button 1", but thats not the real issue. The real issue is that when the copy is made the original button in the original document no longer has the macro assigned to it?
My code is as follows:
Code:
Sub ExportRep()
'
' ExportRep Macro
'
'
Sheets("Report").Select
ActiveSheet.Buttons.Add(579.75, 135.75, 118.5, 40.5).Select
Sheets("Report").Copy
ActiveSheet.Shapes.Range(Array("Button 1")).Select
Selection.Delete
End Sub
I'm not sure what i'm doing wrong. Might it be that I have to change the order of how i'm doing something, or when I assign the macro to the button?
Thanks in advance!