![]() |
|
#1
|
|||
|
|||
|
Hello,
I am getting a "type mismatch" error when looping through Boolean variables trying to identify any variables that have a value of FALSE. My code resides in a Module and is below: Code:
Public txt1Changed As Boolean
Public txt2Changed As Boolean
Public txt3Changed As Boolean
Public txt4Changed As Boolean
Public txt5Changed As Boolean
Public txt6Changed As Boolean
Public txt7Changed As Boolean
Public txt8Changed As Boolean
Public cbo1Changed As Boolean
Public cbo2Changed As Boolean
Public cbo3Changed As Boolean
Public Sub Test()
txt1Changed = True
txt2Changed = True
txt3Changed = True
txt4Changed = True
txt5Changed = True
txt6Changed = True
txt7Changed = False
txt8Changed = True
Dim i As Integer
For i = 1 To 8
If ("txt" & CStr(i) & "Changed") = False Then
MsgBox ("Textbox " & i & " has not been changed.")
'.SetFocus
Exit Sub
End If
Next i
End Sub
Thanks for any help
Last edited by Charles Kenyon; 03-26-2019 at 06:51 AM. Reason: Mark as solved |
|
|
Similar Threads
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Generate template-based letter with multiple variables | shallaes | Word VBA | 5 | 07-12-2018 12:18 AM |
| Multiple Problems with a loop | Radtastic10 | Excel Programming | 3 | 06-09-2017 09:38 AM |
| Testing multiple values of two independant variables and charting results | sgcannon | Excel | 0 | 10-20-2015 10:10 AM |
| Array to iterate through variables and trap blank variables | Marrick13 | Word VBA | 5 | 08-04-2015 06:19 AM |
| Same values of variables in word add-in are being shared across multiple document | naq.abbas@gmail.com | Word | 0 | 01-13-2014 10:41 AM |