Exit Event

P

Patrick Simonds

The code below cause the contents of TextBox 80 to be placed onto the
worksheet when I exit the cell and it works fine if I Tab out of the cell or
click another TextBox on the same page of my MultiPage control.

My problem is, if the user clicks on the next page of the MultiPage control,
Excel does not recognize it as an exit event. So the value is not placed on
the worksheet. Any ideas?



Private Sub TextBox80_Exit(ByVal Cancel As MSForms.ReturnBoolean)

If TextBox80.Value > "" Then
Worksheets("Income").Range("B3").Formula = "=" & TextBox80.Value

Else

Worksheets("Income").Range("B3").Formula = TextBox80.Value

End If

Call Initialization.Initialization

End Sub
 
M

moon

Add a Change-event to your MultiPage.
The .Value property represents the chosen page, so:

Private Sub YourMultiPage_Change()
If MultiPage.Value = 0 Then 'First Page
'TextBox handling here
End If
End Sub
 
P

Patrick Simonds

I tried many variants of your suggestion but was not able to get more than
the first page to update when I clicked to another page. The MultiPage
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.


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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

textbox validation 2
CheckSpelling a Textbox 5
code problem 2
dynamic multipage 1
There must be an eaiser way 2
Cancel Exit on duplicate 2
Format year problem 1
Unloading Cell Value in Textbox...? 3

Top