Userform doesnt work suddenly

jasonxlui

New Member
Joined
Oct 2, 2021
Messages
6
Office Version
  1. 2010
Platform
  1. Windows
The situation is that I have a userform namely "accounts". Within it, I have a button"A" to trigger another userform namely "account selection".
In the "account selection", I have the "accountok" button to trigger the following code. Previously, when I click the "accountok", I will only unload my second userform. But under the
situation I didnt change the code, some problems happen. When I am opening the Visual Basic Window, I click the "accountok" button, it will directly close my second and first userform at the same time(i.e
close all things). But if I close the Visual Basic Window, the code funtions properly. (Although I dont think it is related to my code below) Anyone can help? Please



Private Sub accountok_Click()

Dim var As String
var = ""

If Me.CheckBox1.Value = True Then
var = "BY"
End If



If accountform.selectclick = "selectclick1" Then
accountform.TextBox1 = var
ElseIf accountform.selectclick = "selectclick2" Then
accountform.TextBox2 = var
ElseIf accountform.selectclick = "selectclick3" Then
accountform.TextBox3 = var
ElseIf accountform.selectclick = "selectclick4" Then
accountform.TextBox4 = var
ElseIf accountform.selectclick = "selectclick5" Then
accountform.TextBox5 = var


End If
Unload accountselection

End Sub
 

Excel Facts

What is the last column in Excel?
Excel columns run from A to Z, AA to AZ, AAA to XFD. The last column is XFD.
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Userform doesnt work suddenly
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem. :)
 
Upvote 0
Welcome to the MrExcel Message Board!

Cross-posting (posting the same question in more than one forum) is not against our rules, but the method of doing so is covered by #13 of the Forum Rules.

Be sure to follow & read the link at the end of the rule too!

Cross posted at: Userform doesnt work suddenly
If you have posted the question at more places, please provide links to those as well.

If you do cross-post in the future and also provide links, then there shouldn’t be a problem. :)
Thanks for reminder. Will follow the rule next time.
 
Upvote 0

Forum statistics

Threads
1,214,990
Messages
6,122,625
Members
449,093
Latest member
catterz66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top