|
-
Oct 24th, 2012, 01:19 PM
#1
Thread Starter
PowerPoster
Interaction with custom toolbar
Hi,
I have created a custom toolbar with a combobox which lists all sheets on startup. When I add or remove sheets using the standard excel actions they aren't listed/removed from the combobox. This is obvious of course, but how do I let my toolbar know that something has changed in the current workbook?
I hope you understand what I'm trying to say.
Thanks for the help in advance.
-
Oct 24th, 2012, 07:19 PM
#2
Re: Interaction with custom toolbar
Maybe you could count the number of sheets when the workbook is opened (with a global variable, save # for later use), then count again when a sheet is activated to see if was activated due to adding or deleting a sheet. Something like this:
Code:
Dim intSheets As Integer
Private Sub Workbook_Open()
intSheets = Worksheets.Count
End Sub
Private Sub Workbook_SheetActivate(ByVal Sh As Object)
Dim intTempCount As Integer
intTempCount = intSheets
intSheets = Worksheets.Count
If intTempCount <> intSheets Then
MsgBox "A sheet has been added or deleted"
End If
End Sub
-
Oct 25th, 2012, 01:26 AM
#3
Thread Starter
PowerPoster
Re: Interaction with custom toolbar
Thanks for the feedback. Unfortunately I can't use the Workbook_Open, 'cause the toolbar is Workbook-independend. Perhaps I'm missing something, but I don't see it.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|