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 |
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 |
Textbox Query
|
All times are GMT +1. The time now is 10:40 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com