Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Textbox Query
I have a userform which transfers data from 119 textbox's to my worksheet.
What I need to do is have a tally of all totals over 100 in these boxes and place in cell "h14" on worksheet tally. Can this be done? Thanks Greg |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Textbox Query
Try these. I wasn't sure whether tally was sum of values or simply count of
textboxes (100). If the latter, change to "tot=tot+1". Dim i As Integer, tot As Integer tot = 0 With UserForm1 For i = 1 To 119 'Assumes texboxes are textbox1, textbox2 etc If Val(.Controls("textbox" & i).Value) 100 Then tot = tot + Val(.Controls("textbox" & i).Value) tot=tot+1 ' ???? End If Next i MsgBox tot End With OR Dim i As Integer, tot As Integer, b As Object tot = 0 For Each b In UserForm1.Controls ' any textbox name If TypeName(b) = "TextBox" Then If Val(b.Value) 100 Then tot = tot + Val(b.Value) tot=tot+1 ' ???? End If End If Next b MsgBox tot HTH "Greg B" wrote: I have a userform which transfers data from 119 textbox's to my worksheet. What I need to do is have a tally of all totals over 100 in these boxes and place in cell "h14" on worksheet tally. Can this be done? Thanks Greg |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Textbox Query
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
textbox query | Excel Discussion (Misc queries) | |||
Textbox Query | Excel Programming | |||
Web Query - UserID/Password Protected Textbox | Excel Programming | |||
textbox query | Excel Programming | |||
textbox query | Excel Programming |