ball_richard
08-22-2008, 06:20 AM
Hello, I have made an add-in that adds an item to the 'tools' bar and then opens a userform. The add-in relies on a hidden sheet to store data in the userform so that it is still available once the userform is closed/reopened.
For the add-in to work, I have put in a piece of code that adds a new worksheet with the correct name to whatever workbook the user is using... the only problem is that it adds a new sheet everytime the userform is opened. Is there a way of getting it to add just the first time the macro button is clicked so that you don't end up with a new sheet everytime....
The code used is..
Sub ShowForm()
On Error Resume Next
Set NewSheet = Worksheets.Add
NewSheet.Name = "dd"
Worksheets("dd").Visible = False
UndPileCalcForm.Show
End Sub
Any help would be greatly appreciated.. thanks!
For the add-in to work, I have put in a piece of code that adds a new worksheet with the correct name to whatever workbook the user is using... the only problem is that it adds a new sheet everytime the userform is opened. Is there a way of getting it to add just the first time the macro button is clicked so that you don't end up with a new sheet everytime....
The code used is..
Sub ShowForm()
On Error Resume Next
Set NewSheet = Worksheets.Add
NewSheet.Name = "dd"
Worksheets("dd").Visible = False
UndPileCalcForm.Show
End Sub
Any help would be greatly appreciated.. thanks!