ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Automate a button click event (https://www.excelbanter.com/excel-programming/339553-automate-button-click-event.html)

JD

Automate a button click event
 
I am new to Excel programming .
I have a VB project that fills an Excel spreadsheet and upon completion it
becomes visible. However I need to make changes in one column. I created a
button that the user clicks and the entries change.
How do I get a button click event to fire automatically when the form
activates after the spreadsheet has been filled.

thanks



Jim Thomlinson[_4_]

Automate a button click event
 
Is your button from the Control Toolbox or from the forms toolbar. Buttons
from the control toolbox write their code right in the sheet upon which they
are placed and are actual buttons with properties... Buttons from the Forms
toolbar are more like pictures of buttons and are attached to code written in
modules.

If from the control toolbox then in the sheet you will have private button
click event code. Change this procedure from private to public and you can
just call it like any other procedure, kinda like this.

Sheet1.CommandButton1_Click()

If from the forms tool bar then just reference the module code kinda like
this...

module1.MySub
--
HTH...

Jim Thomlinson


"JD" wrote:

I am new to Excel programming .
I have a VB project that fills an Excel spreadsheet and upon completion it
becomes visible. However I need to make changes in one column. I created a
button that the user clicks and the entries change.
How do I get a button click event to fire automatically when the form
activates after the spreadsheet has been filled.

thanks





All times are GMT +1. The time now is 05:08 PM.

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