I have an Excel 'database' that I need to update some records on but ubfortunately the Select Case statement is not working as I expected it to.
This the code that I have:
Select Case cbVI2
Case = True And cbHI2 = True
Range("U" & Count).Value = "DUAL"
Case = True And cbHI2 = False
Range("U" & Count).Value = "VI"
Case False And cbHI2 = True
Range("U" & Count).Value = "HI"
Case False And cbHI2 = False
Range("U" & Count).Value = " "
End Select
cbVI2 is a checkbox and at this point it's value is FALSE, cbHI2 is also a checkbox but it's value at this point is TRUE.
What I am expecting as it runs through the Select Case routine is that the first 2 statements are ignored and the third statement is the working statement. However, when I hover the mouse over the expressions I see the following:
True = True
cbHI2 = True
The first statement is ignored but the second works leading to my cell having 'VI' put into it instead of 'HI'![Confused :confused: :confused:](data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7)
I have 'debugged' this over and over and cannot see why this happening.
This the code that I have:
Select Case cbVI2
Case = True And cbHI2 = True
Range("U" & Count).Value = "DUAL"
Case = True And cbHI2 = False
Range("U" & Count).Value = "VI"
Case False And cbHI2 = True
Range("U" & Count).Value = "HI"
Case False And cbHI2 = False
Range("U" & Count).Value = " "
End Select
cbVI2 is a checkbox and at this point it's value is FALSE, cbHI2 is also a checkbox but it's value at this point is TRUE.
What I am expecting as it runs through the Select Case routine is that the first 2 statements are ignored and the third statement is the working statement. However, when I hover the mouse over the expressions I see the following:
True = True
cbHI2 = True
The first statement is ignored but the second works leading to my cell having 'VI' put into it instead of 'HI'
I have 'debugged' this over and over and cannot see why this happening.