Userform, button, excel

Geronimo -  
jordane45 Posted messages 30426 Registration date   Status Modérateur Last intervention   -
Hello,
I created a userform in Excel and I've done this manipulation several times. I want to create a button on an Excel sheet. When you click on it, it triggers the userform.

However, when I right-click, assign a macro, I don't see my userform appearing!

Does anyone have an idea ??

Thanks
Configuration: Windows 2000 Internet Explorer 6.0

3 réponses

Gibson
 
Hi,

I'm responding a bit late, you never know. If this can help someone

To call a userform via an Excel macro, you need to create a macro in a module that calls the window.
Then, you will assign this macro to the button

For example:

Sub CallUserForm()
TheNameOfMyUserForm.show
End Sub

See you
Gibson
21
lermite222 Posted messages 9042 Status Contributeur 1 199
 
Hello,
If you're going to make a comment, it should be complete. The action you're referring to is with a button from the FORM tools
With a button from the control toolbox, it's like akmer explains, except that it’s not Hide you should put but...
UserForm1.Show
Catch you later

--
Experience teaches more surely than advice. (André Gide)
If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
0
akmer Posted messages 266 Registration date   Status Membre Last intervention   51
 
Mets-toi en mode création et clique deux fois sur le bouton que tu as créé. VBA va s'ouvrir et tape entre les lignes qui apparaissent ceci : UserForm1.Hide (il est possible que ce soit UserForm2 ou UserForm3... cela dépend du numéro de ta UserForm).
2
Tomjefferson Posted messages 12 Status Membre 1
 
Seriously, I can see that you are all trying to provide answers, but quite honestly, I'm coming here 8 years later, and a novice has no way of knowing how to solve this question. Could you be a little clearer and provide more detailed answers, please?
1
jordane45 Posted messages 30426 Registration date   Status Modérateur Last intervention   4 830
 
Hello,
What do you not understand in Gibson's response?

This? :

You need to create a macro in a module

Well... in the macro editor... you go to the INSERT menu / MODULE.
Then, inside, you paste the code
 Sub AppelerUserForm() Load LeNomDeMaUserForm LeNomDeMaUserForm.show End Sub 

Of course... you replace "LeNomDeMaUserForm" ... well... with the name of your userform (usually, by default, "Userform1")

Then, (you should have started there actually...), check out this tutorial
https://silkyroad.developpez.com/VBA/UserForm/
0