I have a macro for copying a template worksheet and pasting it over specific sheets when a named cell (Overwrite_Sheetn) says "Yes".
It's not elegant, and only works some of the time.
For some reason some of the sheets won't copy and paste the template file.
I have 20 sheets that can be overwritten (Overwrite_Sheet1 to Overwrite_Sheet20)
NB: The below snippet is only showing the first three instances.
Can someone point out where I'm going wrong?
Or is there a better way of doing this?
Thanks
It's not elegant, and only works some of the time.
For some reason some of the sheets won't copy and paste the template file.
I have 20 sheets that can be overwritten (Overwrite_Sheet1 to Overwrite_Sheet20)
NB: The below snippet is only showing the first three instances.
VBA Code:
Sub Copy_Template()
'
' 7.0 Template_Copy Macro
'
'
Application.ScreenUpdating = False
If [Overwrite_Sheet1] = "Yes" Then
Sheets("Template").Select
Cells.Select
Selection.Copy
Worksheets(1).Select
Cells.Select
ActiveSheet.Paste
End If
If [Overwrite_Sheet2] = "Yes" Then
Sheets("Template").Select
Cells.Select
Selection.Copy
Worksheets(2).Select
Cells.Select
ActiveSheet.Paste
End If
If [Overwrite_Sheet3] = "Yes" Then
Sheets("Template").Select
Cells.Select
Selection.Copy
Worksheets(3).Select
Cells.Select
ActiveSheet.Paste
End If
Application.ScreenUpdating = True
End Sub
Can someone point out where I'm going wrong?
Or is there a better way of doing this?
Thanks