PDA

View Full Version : Sleeper: Adding a sheet



lior03
06-19-2005, 11:26 PM
hello
is it possible to create an event maybe through a class module everytime a new sheet is added to a workbook.
i already have a macro that generates a list of sheets in the workbook including an hyperlink to each sheet.
i would like to combine the two procedures.
thanks

Jacob Hilderbrand
06-19-2005, 11:51 PM
Try this code in the ThisWorkbook Module.


Option Explicit

Private Sub Workbook_NewSheet(ByVal Sh As Object)
MsgBox Sh.Name
End Sub

sheeeng
06-20-2005, 09:34 PM
hello
is it possible to create an event maybe through a class module everytime a new sheet is added to a workbook.
i already have a macro that generates a list of sheets in the workbook including an hyperlink to each sheet.
i would like to combine the two procedures.
thanks

Could you upload your file for us to view? Thanks. :hi:

You can try


Call Worksheets.Add([Before], [After], [Count], [Type])



Change ([Before], [After], [Count], [Type]) according to your needs.