Hi am a complete noob in programming and VBA. I have created a userform and added a few comboboxes. Within the comboboxes I have created a drop down list using the With .additem EndWith function. Now every time a user presses an item within a combobox i have inserted message boxes by using codes such as this
if ComboBox1.ListIndex = 2 Then Msgbox "Do you want to open the Reports screen?", vbYesNo
The code Works but sometimes the user must press the button several times make the MsgBox appear.
I have now created a new userform and have tried to make the following
if ComboBox1.ListIndex = 1 Msgbox msg("Do you want to create a new company?", vbYesNo) = vbYes then userform1.show
The above code doesn't work but due to my lack of knowledge i don't know what else to do that's why i am here.So the above code means that if within combobox1 you go down a row and press it you should be able to get a yesNo msgbox and if you press yes then Userform1 should appear.
I know its doable because ive managed to make userform 1 appear but my problem is VByesNO.
Then
hence is a syntax error. In any event, if all you give are code fragments without adequate context, you aren't going to get an answer. Please give a minimal reproducible example – John Colemanmsg(
and you could useif ComboBox1.ListIndex = 1 and Msgbox ("Do you want to create a new company?", vbYesNo) = vbYes then
This would have been clear from the help onmsgbox
not experience/years coding. – Nathan_Sav