ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,226
- Office Version
- 2007
- Platform
- Windows
Morning,
Im having an issue trying to get this to work correctly but now im confused with what ive done.
The code i have in use is supplied below.
This is how it should work.
I open the worksheet & the Msgbox reads ADD CUSTOMER TO WORKSHEET
Yes should then DatabaseUserForm.Show
No should then DatabaseNameSearch.Show
My issues are when closing a form the other is shown or if i select Yes then nothing is shown at all.
Im having an issue trying to get this to work correctly but now im confused with what ive done.
The code i have in use is supplied below.
This is how it should work.
I open the worksheet & the Msgbox reads ADD CUSTOMER TO WORKSHEET
Yes should then DatabaseUserForm.Show
No should then DatabaseNameSearch.Show
My issues are when closing a form the other is shown or if i select Yes then nothing is shown at all.
VBA Code:
Private Sub Worksheet_Activate()
Range("A5").Select
Range("A6").Select
Dim answer As Integer
answer = MsgBox("ADD NEW CUSTOMERS NAME TO WORKSHEET ?", vbQuestion + vbYesNo + vbDefaultButton2, "DATABASE NEW CUSTOMERS NAME MESSAGE")
If answer = vbNo Then
answer = MsgBox("SEARCH FOR CUSTOMER IN WORKSHEET ?", vbQuestion + vbYesNo + vbDefaultButton2, "DATABASE SEARCH FOR CUSTOMER MESSAGE")
Else
DatabaseUserForm.Show
If answer = vbYes Then
DatabaseNameSearch.Show
Else
DatabaseUserForm.Show
End If
End If
End Sub