View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default count where item =x

As long as you named them nice, you can just loop through them:

Option Explicit
Private Sub CommandButton1_Click()
Dim iCtr As Long
Dim MaxTBX As Long
Dim TotTBX As Long

MaxTBX = 3 '10 for you

TotTBX = 0
For iCtr = 1 To MaxTBX
If LCase(Me.Controls("txt_ci" & iCtr).Value) = "x" Then
TotTBX = TotTBX + 1
End If
Next iCtr

MsgBox TotTBX

End Sub

But if you're looking for an X (some kind of indicator???), maybe using 10
checkboxes would be better. Less chance of typing errors????



alvin Kuiper wrote:

Hi
If i have 10 text boxe like txt_ci1 - txt_ci2 and so on

Is there a way to count all them where there are a X in

Regards

alvin


--

Dave Peterson