Hello - apologies if this is a really basic thing but I know nothing about coding and am struggling to understand why what I thought was a simple macro is not performing as expected.
I have a whole series of worksheets, one for each hotel I am recording information about.
I have a master blank one called ".New Hotel Sheet" which I will use as a master template. (it it .New..... so it sorts to the beginning of the worksheet tabs)
I created a button, then linked and recorded a macro (called "NewHotel"), whereby I selected this "New Hotel Sheet", selected the entire worksheet, then added a new sheet and pasted the details across.
For some reason, this new sheet does not however copy the other buttons or form controls such as scroll boxes I have on the master document.
I have copied the code from the VBA window below if anyone can shed any light. I'm probably doing something really stupid, but I thought this would be a simple macro to record and that this was the point of a macro/button - to simplify repeated tasks? I just can't understand what I'm doing wrong. I f I manually copy and then paste the worksheet then it copies the buttons and scroll box controls fine, so what am I missing when I do the exact same steps but having pressed to record the macro on it yet then running that macro produces a different result?
Thanks so much to anyone who can help a VBA/macro newbie
Ian
Sub NewHotel()
'
' NewHotel Macro
'
'
Sheets(".New Hotel Sheet").Select
Cells.Select
Selection.Copy
Sheets("1 INDEX").Select
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Range("D13").Select
End Sub
I have a whole series of worksheets, one for each hotel I am recording information about.
I have a master blank one called ".New Hotel Sheet" which I will use as a master template. (it it .New..... so it sorts to the beginning of the worksheet tabs)
I created a button, then linked and recorded a macro (called "NewHotel"), whereby I selected this "New Hotel Sheet", selected the entire worksheet, then added a new sheet and pasted the details across.
For some reason, this new sheet does not however copy the other buttons or form controls such as scroll boxes I have on the master document.
I have copied the code from the VBA window below if anyone can shed any light. I'm probably doing something really stupid, but I thought this would be a simple macro to record and that this was the point of a macro/button - to simplify repeated tasks? I just can't understand what I'm doing wrong. I f I manually copy and then paste the worksheet then it copies the buttons and scroll box controls fine, so what am I missing when I do the exact same steps but having pressed to record the macro on it yet then running that macro produces a different result?
Thanks so much to anyone who can help a VBA/macro newbie
Ian
Sub NewHotel()
'
' NewHotel Macro
'
'
Sheets(".New Hotel Sheet").Select
Cells.Select
Selection.Copy
Sheets("1 INDEX").Select
Sheets.Add After:=ActiveSheet
Selection.PasteSpecial Paste:=xlPasteAllUsingSourceTheme, Operation:=xlNone _
, SkipBlanks:=False, Transpose:=False
Range("D13").Select
End Sub