View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Corey Corey is offline
external usenet poster
 
Posts: 363
Default Modify code to Add ComboBoxes instaed of Textbox values on Userform ?

Was:
Sub AddTxBxs() ' This Code Worked great for Textboxes
Dim TxBx As Control
Const T As String = "TextBox"
Dim sng122Total As Single
For Each TxBx In UserForm11.Controls
Select Case TxBx.Name
Case T & 62, T & 63, T & 66, T & 64, T & 65, T & 66, T & 67, T & 68, T & 69,
T & 70, T & 71
If IsNumeric(TxBx.Text) Then
sng122Total = sng122Total + TxBx.Text
End If
End Select
Next TxBx
UserForm11.TextBox122.Text = sng122Total
end sub

I have changed the Textboxes not to Comboboxes,
So i change the above to :
Sub AddCmbs() " This Code Does Not Add the Comboboxes
Dim ComboBox As Control
Const cmb As String = "ComboBox"
Dim sng122Total As Single
For Each cmb In UserForm11.Controls
Select Case cmb.Name
Case cmb & 23, cmb & 24, cmb & 25, cmb & 26, cmb & 27, cmb & 28, cmb & 29,
cmb & 30, cmb & 31, cmb & 32
If IsNumeric(cmb.Text) Then
sng122Total = sng122Total + cmb.Text
End If
End Select
Next cmb
UserForm11.TextBox122.Text = sng122Total
end sub

Can someone let me know why and/or how to get it to work ?

Corey....