View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Greg Wilson Greg Wilson is offline
external usenet poster
 
Posts: 747
Default Summerizing 35 codes in one

Paste to the ThisWorkbook module. Assumed is that the sheet containing the
combo boxes is named "Sheet1". Change to suit. Also, assumed is that there
are no other combo boxes on the sheet except the 35 you meantioned:-

Dim ComboArr(1 To 35) As New Class1

Private Sub Workbook_Open()
Dim OLEObj As OLEObject
Dim i As Integer
For Each OLEObj In Sheets("Sheet1").OLEObjects
If TypeOf OLEObj.Object Is MSForms.ComboBox Then
i = i + 1
Set ComboArr(i).Combo = OLEObj.Object
End If
Next
End Sub

Paste to the Class Module:-

Public WithEvents Combo As MSForms.ComboBox
Private Sub Combo_Change()
MsgBox "Test abcde"
End Sub

Regards,
Greg

"LoveCandle" wrote:


Thank you all for your help,,

Mr. Greg Wilson your codes seems to be great but, my comboboxes are
not put on a userform .. they are put on the worksheet itself

so can you please edit the code to work on the worksheet not on a user
form.

Thank you again,


--
LoveCandle
------------------------------------------------------------------------
LoveCandle's Profile: http://www.excelforum.com/member.php...o&userid=28612
View this thread: http://www.excelforum.com/showthread...hreadid=564205