ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   code on a template sheet (https://www.excelbanter.com/excel-programming/386697-code-template-sheet.html)

Saintsman

code on a template sheet
 
I have a template page in my workbook which users can copy & rename to record
cost estimates
Part of the sheet compares the previous estimate with the lastest
I want an update button which copies columns F-H & pastes the values in
columns C-E. This code needs to be in the 'template' sheet, but obviously
needs to work whenever the sheet is copied & renamed

I have a macro which works on a global scale, but how do I make it sheet
specific for sheets that haven't been created yet?

Sub copylast()
Sheets("Shell and Core").Select
Range("f6:h50").Select
Selection.Copy
Range("c6").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Application.CutCopyMode = False
Range("f6").Select
End Sub


All times are GMT +1. The time now is 12:24 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com