Objective of using Two Toggle Button:
On clicking Toggle Button1 - Activates Toggle Button1 with color blue and makes toggle button2 color black
On clicking Toggle Button2 - Activates Toggle Button2 with color blue and makes toggle button1 color black
Problem:
Earlier was working, now clicking either toggle Button1 or Button2 nothing happens.
Toggle button was working properly earlier now it is not. On clicking only once on any one of the toggle button, it remains in loop.
Not certain why the code is doing it, as same Code works on different Windows Xp SP3 computer. Tried using Option button same thing is happening.
It seems system issue (Windows Xp SP3), question what could be?
Tried below steps for solving the problem:
- I have uninstall, reinstall VBA and MS Excel 2003 still the same.
- Tested the procedure on different Xp SP3 computer with Excel 2003 - it works.
- Did code debugging (F8)
1) On clicking Toggle Button1 it completes the steps from line 1 to 7, after executing the line 7 - the cursor moves to another procedure tglbtn_2_click (not calling any code)
when it is on procedure tglbn_2_click - it moves to next line 11 than returns to line 10 and starts the process again from line 11 moves to 12, 13..16.
After moving to line 16 it goes to previous procedure (tglbtn_1_click) to line1 and moves to line2 again to line1
and process from line 1 to 7.
Code:
Code:
1 Private Sub tglBtn_1_Click()
2 tglBtn_1.Value = True
3 tglBtn_1.ForeColor = vbBlue
4 pub_TglBtn12 = "1"
5
6 tglbtn_2.ForeColor = vbBlack
7 tglbtn_2.Value = False
8 End Sub
9
10 Private Sub tglBtn_2_Click()
11 tglbtn_2.Value = True
12 tglbtn_2.ForeColor = vbBlue
13 pub_TglBtn12 = "2"
14
15 tglBtn_1.ForeColor = vbBlack
16 tglBtn_1.Value = False
17 End Sub