ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   invoke a function (https://www.excelbanter.com/excel-programming/335687-invoke-function.html)

mmc

invoke a function
 
I need to invoke a function(fx) once a user clicks on button1
ex. Application.Worksheetfinction.CountA -- Is this correct?
Thanks...


Tom Ogilvy

invoke a function
 
assume button1 is a commandbutton named CommandButton1. Then double click
on it in design mode to be taken to the click event

Private Sub Commandbutton1_click()

End Sub

Put in your function there

Private Sub Commandbutton1_click()
msgbox "Count is " & _
application.WorksheetFunction.CountA(Selection)
End Sub

--
Regards,
Tom Ogilvy

"mmc" wrote in message
...
I need to invoke a function(fx) once a user clicks on button1
ex. Application.Worksheetfinction.CountA -- Is this correct?
Thanks...




mmc

invoke a function
 
Tom, what if i just want the function to pop up without a selection range.
Ex. I just want the "Solver" to come up on the screen?

"Tom Ogilvy" wrote:

assume button1 is a commandbutton named CommandButton1. Then double click
on it in design mode to be taken to the click event

Private Sub Commandbutton1_click()

End Sub

Put in your function there

Private Sub Commandbutton1_click()
msgbox "Count is " & _
application.WorksheetFunction.CountA(Selection)
End Sub

--
Regards,
Tom Ogilvy

"mmc" wrote in message
...
I need to invoke a function(fx) once a user clicks on button1
ex. Application.Worksheetfinction.CountA -- Is this correct?
Thanks...





Tom Ogilvy

invoke a function
 
If solver is loaded

Private Sub commandButton1_Click()
CommandBars("Tools").Controls("Sol&ver...").Execut e
End Sub

Note that Solver is an addin - not a worksheet function. If you create a
reference to it in the VBE, you can look at it properties and methods in the
Object browser.


http://support.microsoft.com/support...ver/solver.asp
Creating Visual Basic Macros that Use Microsoft Excel Solver


http://www.solver.com/

--
Regards,
Tom Ogilvy


"mmc" wrote in message
...
Tom, what if i just want the function to pop up without a selection range.
Ex. I just want the "Solver" to come up on the screen?

"Tom Ogilvy" wrote:

assume button1 is a commandbutton named CommandButton1. Then double

click
on it in design mode to be taken to the click event

Private Sub Commandbutton1_click()

End Sub

Put in your function there

Private Sub Commandbutton1_click()
msgbox "Count is " & _
application.WorksheetFunction.CountA(Selection)
End Sub

--
Regards,
Tom Ogilvy

"mmc" wrote in message
...
I need to invoke a function(fx) once a user clicks on button1
ex. Application.Worksheetfinction.CountA -- Is this correct?
Thanks...








All times are GMT +1. The time now is 09:35 AM.

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