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: 68
Default Addition code for 110 TextBoxes

Thank you, but I cannot get it to work for my textbox issue. I used the
following code...


MODULE1 CODE:

Option Explicit
Dim Text1() As New Class1

Sub ShowDialog()
'ButtonCount is now TextCount
'Buttons is now Text1
Dim TextCount As Integer
Dim ctl As Control

TextCount = 0
For Each ctl In UserForm1.Controls
If TypeName(ctl) = "TextBox" Then
If ctl.Name < "OKButton" Then 'Skip the OKButton
TextCount = TextCount + 1
ReDim Preserve Text1(1 To TextCount)
Set Text1(TextCount).ButtonGroup = ctl
End If
End If
Next ctl
UserForm1.Show
End Sub

CLASS1 CODE:
Public WithEvents ButtonGroup As TextBox

Private Sub ButtonGroup_Click()
MsgBox "Hello from " & ButtonGroup.Name
End Sub

WHen I run it, I get the error "Object does not source automation events"

It highlights this bit of code
Public WithEvents ButtonGroup As TextBox



"Tom Ogilvy" wrote in message
...
Use John Walkenbach's method

http://j-walk.com/ss/excel/tips/tip44.htm
Handle Multiple UserForm Buttons With One Subroutine


although written for comandbuttons, it can be adapted to your situation I
would think.

Another solution might be to link your textboxes to cells in a worksheet

and
have a sum function get the value of all the cells.



--
Regards,
Tom Ogilvy


Todd Huttenstine wrote in message
...
The below code adds up all the values of the specified TextBoxes. I

need
this code to run after any value in any of the specified textboxes

change
in
addition to another 88 TextBoxes that I have not listed. Instead of

having
to put this code in all 110 TextBoxes, is there an easier way to get

this
code to run?

TextBox9.Value TextBox14.Value + TextBox19.Value + TextBox24.Value +
TextBox29.Value + TextBox34.Value + _
TextBox39.Value + TextBox44.Value + TextBox49.Value + TextBox54.Value +
TextBox59.Value + TextBox64.Value + _
TextBox69.Value + TextBox74.Value + TextBox79.Value + TextBox84.Value +
TextBox89.Value + TextBox94.Value + _
TextBox99.Value + TextBox104.Value + TextBox109.Value + TextBox114


Thank you

Todd Huttenstine






 
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
addition error code is 1E+05. What does that mean? jojosf Excel Discussion (Misc queries) 4 April 4th 23 10:17 AM
Textboxes SAL Excel Discussion (Misc queries) 2 July 13th 07 12:24 AM
tab between several textboxes Kim Excel Worksheet Functions 0 May 9th 05 04:08 PM
Addition code for 110 TextBoxes John Wilson Excel Programming 4 January 27th 04 03:41 AM
Excel Textboxes Cade09 Excel Programming 1 November 21st 03 05:17 PM


All times are GMT +1. The time now is 04:43 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"