Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Using Checkboxes

I'd like to create a userform containing multiple checkboxes that, after the
user enables the ones selected, will run a corresponding VB macro. For
example, I'd like to create a checklist of customer names, the user selects
the ones to be processed, then the user would click a "Go" button, then all
of the selected customer names would invoke a corresponding but different VB
macro. (Customer1 would run macro1, Customer2 would run macro2... not macro1,
etc.) Does anyone have sample code I can refer to?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 60
Default Using Checkboxes

There are various ways, the easiest is probably to insert a new module and
place your code there, such as
Sub Customer1()
MsgBox "Customer Selected"
End Sub

then in the code on the sheet you can call that sub
Call Customer1

then messagebox will appear.
Now just check to see if each is selected and call the appropriate sub routine
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"Freddy" wrote:

I'd like to create a userform containing multiple checkboxes that, after the
user enables the ones selected, will run a corresponding VB macro. For
example, I'd like to create a checklist of customer names, the user selects
the ones to be processed, then the user would click a "Go" button, then all
of the selected customer names would invoke a corresponding but different VB
macro. (Customer1 would run macro1, Customer2 would run macro2... not macro1,
etc.) Does anyone have sample code I can refer to?

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default Using Checkboxes

I wrote sample code as per your example, however, after Sub Customer1() is
done how do I direct the code back to check the value of the next checkbox
and so on? Here is an outline of what I've done so far:

Private Sub UserForm_Initialize()

CheckBox1.Caption = "Customer1"
CheckBox2.Caption = "Customer2"
CheckBox3.Caption = "Customer3"

End Sub

Private Sub CommandButton1_Click()

If CheckBox1.Value = True Then Call SubCustomer1
If CheckBox2.Value = True Then Call SubCustomer2
If CheckBox3.Value = True Then Call SubCustomer3

End Sub

Sub Customer1()
My code€¦
End Sub

Sub Customer2()
My code€¦
End Sub

Sub Customer3()
My code€¦
End Sub


"John Bundy" wrote:

There are various ways, the easiest is probably to insert a new module and
place your code there, such as
Sub Customer1()
MsgBox "Customer Selected"
End Sub

then in the code on the sheet you can call that sub
Call Customer1

then messagebox will appear.
Now just check to see if each is selected and call the appropriate sub routine
--
-John Northwest11
Please rate when your question is answered to help us and others know what
is helpful.


"Freddy" wrote:

I'd like to create a userform containing multiple checkboxes that, after the
user enables the ones selected, will run a corresponding VB macro. For
example, I'd like to create a checklist of customer names, the user selects
the ones to be processed, then the user would click a "Go" button, then all
of the selected customer names would invoke a corresponding but different VB
macro. (Customer1 would run macro1, Customer2 would run macro2... not macro1,
etc.) Does anyone have sample code I can refer to?

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
Checkboxes Elaine Excel Discussion (Misc queries) 6 August 20th 09 01:41 AM
Checkboxes Robbyn Excel Programming 2 June 13th 06 06:25 PM
Checkboxes and Other cmk18[_3_] Excel Programming 1 April 5th 04 05:09 AM
checkboxes marksuza[_3_] Excel Programming 3 December 11th 03 03:19 PM
Checkboxes Tom Ogilvy Excel Programming 0 August 11th 03 05:45 PM


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

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

About Us

"It's about Microsoft Excel"