P
Patrick Simonds
I use a MultiPage control to gather data and have it placed on my
worksheets. I have code which causes the data to be placed on the worksheet
when you exit one (of 10) TextBox for another, my problem is if the user
clicks on the next page of the MultiPage control, Excel does not recognize
it as an exit event from a TextBox. So the value is not placed on the
worksheet.
I used this approach (as opposed to just placing the data on the worksheet
upon closing the UserForm,which is easy) because I have a TextBox on the
UserForm which must be updated as numbers are entered. Now someone suggested
that I use the code below.
As you can see I want to apply this code to MultiPage2. I tried many
variants of the suggested code, but was not able to get more than the first
page to update when I clicked to another page. MultiPage2 control has 6
pages (January, February, March, April, May, June). This is where I am now,
but again it only works when I click from January to any of the other pages.
Proposed code:
Private Sub YourMultiPage_Change()
If MultiPage.Value = 0 Then 'First Page
'TextBox handling here
End If
End Sub
Adapted Code:
Private Sub MultiPage2_Change()
If MultiPage2.Value = 0 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 1 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 2 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 3 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 4 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 5 Then
PopulateWorksheets.PopulateWorksheets
End If
End Sub
worksheets. I have code which causes the data to be placed on the worksheet
when you exit one (of 10) TextBox for another, my problem is if the user
clicks on the next page of the MultiPage control, Excel does not recognize
it as an exit event from a TextBox. So the value is not placed on the
worksheet.
I used this approach (as opposed to just placing the data on the worksheet
upon closing the UserForm,which is easy) because I have a TextBox on the
UserForm which must be updated as numbers are entered. Now someone suggested
that I use the code below.
As you can see I want to apply this code to MultiPage2. I tried many
variants of the suggested code, but was not able to get more than the first
page to update when I clicked to another page. MultiPage2 control has 6
pages (January, February, March, April, May, June). This is where I am now,
but again it only works when I click from January to any of the other pages.
Proposed code:
Private Sub YourMultiPage_Change()
If MultiPage.Value = 0 Then 'First Page
'TextBox handling here
End If
End Sub
Adapted Code:
Private Sub MultiPage2_Change()
If MultiPage2.Value = 0 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 1 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 2 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 3 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 4 Then
PopulateWorksheets.PopulateWorksheets
ElseIf MultiPage2.Value = 5 Then
PopulateWorksheets.PopulateWorksheets
End If
End Sub