Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 44
Default vba to click a command button


Hi Chris,

It appears that you want to have this macro run at various times without the
need to manually click a button. You could do something like put the call to
the macro
in the Worksheet_Change event code... Like so ...

Public Sub Worksheet_Change(ByVal Target as Range)

Dim somePeriod as Long
Dim someThreshold as Long

someThreshold = 5 ' arbitrary

somePeriod = now

if Now % somePeriod someThreshold
call macroName()
end if


End Sub

The worksheet_Change is an automatic event handler that gets called whenever
you make any change to a particular worksheet. Alt+F11 and click on the
worksheet in the window browser to find it. There are several other auto
event handler functions to choose from as well.

There are several approaches to calling some macro without the need to
manually push a button. Think the most appropriate in your case is to mess
with the event handler routines. (Most common one is Worksheet_Change)

Hope that helps,
Chad



" wrote:

Hi there,

I've got a model which I need to run many times, and I want to script
it to save my having to sit here doing it by hand...

the data which the model runs on is entered on one of the sheets (the
sheet is called "select"). On the basis of data entered by the user, a
button on this sheet is hit, and the model runs...


I want to automate the filling in of this sheet with all the
appropriate data with a script that loops so I don't have to *be* at
the computer to hit the button... This I have done


What I'm stuck on is how to automate the hitting of the button! is this
possible?

for example, how can I call CommandButton1_click() from another macro?

I want to do something like the following

sheet("SELECT").commandbutton1_click()

but it doesn't like it!


Hope this makes sense

cheers

chris


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Command Button Click bmolintas Excel Discussion (Misc queries) 4 November 8th 07 10:37 PM
VBA Click Command Button Benz Excel Programming 5 August 4th 06 09:30 PM
why do i have to click my 2nd command button twice rjudge Excel Programming 9 April 5th 06 04:16 PM
Is there any way to have a maco click a command button ChairMan Excel Discussion (Misc queries) 0 March 23rd 06 03:58 PM
How to add a command button and on-click within vba Papa Jonah Excel Programming 9 December 2nd 04 12:10 AM


All times are GMT +1. The time now is 09:45 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"