Above the following statements, BAL_SHT_TAB_NAME has been set and I can see in the watch window as I step through one loop that
the second test in the If Then statement InStr(1, Worksheets(BAL_SHT_TAB_NAME).Range("A2").Value, "Millions", vbTextCompare) = 4. So I would think the Then statement would be executed and set BAL_SHT_UNITS to a value of 1000000
My problem is that even though I can see VB execute the Then statement, the BAL_SHT_UNITS value is still 0 after execution.
If anyone sees an obvious error I would appreciate some help.
Alternatively, if anyone can suggest how I can track down the problem I would appreciate it.
Dim BAL_SHT_UNITS As Long
BAL_SHT_UNITS = 0
If InStr(1, Worksheets(BAL_SHT_TAB_NAME).Range("A2").Value, "Thousands", vbTextCompare) > 0 Then
BAL_SHT_UNITS = 1000
ElseIf InStr(1, Worksheets(BAL_SHT_TAB_NAME).Range("A2").Value, "Millions", vbTextCompare) > 0 Then
BAL_SHT_UNITS = 1000000
Else: BAL_SHT_UNITS = 1
End If
the second test in the If Then statement InStr(1, Worksheets(BAL_SHT_TAB_NAME).Range("A2").Value, "Millions", vbTextCompare) = 4. So I would think the Then statement would be executed and set BAL_SHT_UNITS to a value of 1000000
My problem is that even though I can see VB execute the Then statement, the BAL_SHT_UNITS value is still 0 after execution.
If anyone sees an obvious error I would appreciate some help.
Alternatively, if anyone can suggest how I can track down the problem I would appreciate it.
Dim BAL_SHT_UNITS As Long
BAL_SHT_UNITS = 0
If InStr(1, Worksheets(BAL_SHT_TAB_NAME).Range("A2").Value, "Thousands", vbTextCompare) > 0 Then
BAL_SHT_UNITS = 1000
ElseIf InStr(1, Worksheets(BAL_SHT_TAB_NAME).Range("A2").Value, "Millions", vbTextCompare) > 0 Then
BAL_SHT_UNITS = 1000000
Else: BAL_SHT_UNITS = 1
End If