LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 550
Default Control Number - A better way

I use something similar to this in a lot of userforms and was hoping that
there might be a better way.

Scenario.......
I want to pass the number of the CommandButton clicked to another sub.

How I do it now......
Private Sub CBClick()
' Do stuff here based on the BoxClicked Number
End Sub
Private Sub CommandButton1_Click()
BoxClicked = 1
CBClick
End Sub
Private Sub CommandButton2_Click()
BoxClicked = 2
CBClick
End Sub

' continued for another 97 Command Buttons

Private Sub CommandButton99_Click()
BoxClicked = 99
CBClick
End Sub

Is there a better way?????

Thanks,
John


 
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
How to make control number in cell Jon Excel Discussion (Misc queries) 1 July 21st 07 09:13 PM
Number of UserForm Control Objects IT_roofer Excel Programming 14 June 12th 07 08:36 PM
Auto control number Freshman Excel Worksheet Functions 1 September 22nd 06 12:40 PM
Control Displays Number Instead of Date Chaplain Doug Excel Programming 1 February 27th 06 06:08 PM
document control number Mark Barnard[_2_] Excel Programming 1 May 2nd 05 02:44 PM


All times are GMT +1. The time now is 08:51 AM.

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"