title: Validation for Userform to check for empty controls, using loops
body: <p>After the user done entering the data. When the user click Submit button. I will check if all the textbox is not empty. 
  The user will enter number of member, if the user enter 1 member I will check if member01 is empty, if the user enter 3 member I will check if member01, member02, member03 is empty
  It works for If Else but I would like to do it for loop, as it is tedious for me to do it 10 times. I don't know how do I change it from If Else to For Loop.</p>
  
  <pre><code> ‘Using If Else
    If txtNoMember.Value = "" Then
          MsgBox "Please enter the Number of Member.", vbExclamation, "Input Data"
          txtNoMember.SetFocus
          Exit Sub
      End If
  
      If txtNoMember.Value = 1 And txtMember01.Value = "" Then
          MsgBox "Member cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
      End If
  
      If txtNoMember.Value = 2 And txtMember01.Value = "" And txtMember02.Value = "" Then
          MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
      ElseIf txtNoMember.Value = 2 And txtMember01.Value = "" Then
          MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
      ElseIf txtNoMember.Value = 2 And txtMember02.Value = "" Then
          MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
      End If
  
      If txtNoMember.Value = 3 And txtMember01.Value = "" Then
          MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
      ElseIf txtNoMember.Value = 3 And txtMember02.Value = "" Then
          MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
      ElseIf txtNoMember.Value = 3 And txtMember03.Value = "" Then
          MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
          MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          Exit Sub
      End If
  
  ‘Using Loop
  Dim Ctrl As Control
  Dim CtrlNum As Long
  
  For Each Ctrl In Me.Controls
      If Ctrl.Name Like "txtMember##" Then
          CtrlNum = CLng(Right$(Ctrl.Name, 2))
          If CtrlNum.Value = "" Then
              MsgBox "Member(s) cannot be empty.", vbExclamation, "Input Data"
          End If
      End If
  Next
  </code></pre>