G
Guest
Help pls! I need a procedure which can help me to select a selection A and B
respectively, so that selection A is chosen every other time the procedure
runs (and the same for selection B). I intended to make a procedure that sets
the flag to TRUE when the flag is FALSE and vice versa. In the code presented
below, the boolean value remains FALSE and never changes to TRUE.
What I am doing wrong??
Public Sub Insert_Flag()
Dim Worksheet As Worksheet
Dim Flg As Boolean
Set Worksheet = ActiveSheet
Select Case Flg
Case Flg = True (Selection A)
Flg = False
If Flg = False Then Cells(1, 3) = False
Case Flg = False (Selection B)
Flg = True
If Flg = True Then Cells(1, 3) = True
End Select
End Sub
respectively, so that selection A is chosen every other time the procedure
runs (and the same for selection B). I intended to make a procedure that sets
the flag to TRUE when the flag is FALSE and vice versa. In the code presented
below, the boolean value remains FALSE and never changes to TRUE.
What I am doing wrong??
Public Sub Insert_Flag()
Dim Worksheet As Worksheet
Dim Flg As Boolean
Set Worksheet = ActiveSheet
Select Case Flg
Case Flg = True (Selection A)
Flg = False
If Flg = False Then Cells(1, 3) = False
Case Flg = False (Selection B)
Flg = True
If Flg = True Then Cells(1, 3) = True
End Select
End Sub