ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Button in Form (https://www.excelbanter.com/excel-programming/401565-button-form.html)

bbussoloti

Button in Form
 
I have a problem,
there´s a form, which is accessable via a single button in a sheet.
In this form there´s another button called GO, so i have:

Private Sub Go_Click()
MsgBox ("button clicked... ")
End Sub

When I click this button in my form, nothing happen... the MsgBox warning
does not shows.

What can be the problem here?

JLGWhiz

Button in Form
 
Open the VB editor by pressing Alt + F11 and select your form from the
project window. Right click the command button on the form and select view
code.
Then enter the code below.

Private Sub CommandButton1_Click()
MsgBox ("button clicked... ")
End Sub

Re-post if it still don't work.


"bbussoloti" wrote:

I have a problem,
there´s a form, which is accessable via a single button in a sheet.
In this form there´s another button called GO, so i have:

Private Sub Go_Click()
MsgBox ("button clicked... ")
End Sub

When I click this button in my form, nothing happen... the MsgBox warning
does not shows.

What can be the problem here?


bbussoloti

Button in Form
 
Tks for the answer JLGWhiz, but it still don´t work... i actually renamed my
button "Go" instead of "CommandButton1". I tried what you said just in case,
but no success.

This form i have is accessable via a button NOT in a form. Then, when the
form is open, there´s my Go button, which does not displays the MsgBox... i´m
stuck here.

"JLGWhiz" escreveu:

Open the VB editor by pressing Alt + F11 and select your form from the
project window. Right click the command button on the form and select view
code.
Then enter the code below.

Private Sub CommandButton1_Click()
MsgBox ("button clicked... ")
End Sub

Re-post if it still don't work.


"bbussoloti" wrote:

I have a problem,
there´s a form, which is accessable via a single button in a sheet.
In this form there´s another button called GO, so i have:

Private Sub Go_Click()
MsgBox ("button clicked... ")
End Sub

When I click this button in my form, nothing happen... the MsgBox warning
does not shows.

What can be the problem here?


bbussoloti

Button in Form
 
Ok... i´ve made it work.
Instead of writing the code in the (general) session, i right clicked the
button in the form, selected show code, and it opened a new window with my
button´s name where it was that (general)

"bbussoloti" escreveu:

I have a problem,
there´s a form, which is accessable via a single button in a sheet.
In this form there´s another button called GO, so i have:

Private Sub Go_Click()
MsgBox ("button clicked... ")
End Sub

When I click this button in my form, nothing happen... the MsgBox warning
does not shows.

What can be the problem here?



All times are GMT +1. The time now is 06:46 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com