KROLN
KROLN

Reputation: 300

Paste some VBA code via VBA to each newly genereated sheet

I have a simple code that creates a new sheet in template form after running it. By doing so I get a new sheet with all what I need in my template.

I need to copy aswell a short VBA script Worksheet_Change into that newly created sheets. For ex. code to get the windows user id and date from system after making change in cells in column B.

How can I put that Worksheet_Change script into my vba code for each new sheet created via VBA?

Upvotes: 0

Views: 49

Answers (1)

tony goodwin
tony goodwin

Reputation: 64

Like Andreas said use the workbook sheetchange, and in that you can write a function that adds the user ID and date to sheetname.cells(r,c) - wherever you want - as 'sheetname' is passed when workbook_sheetchange event is called

Upvotes: 1

Related Questions