ipbr21054
Well-known Member
- Joined
- Nov 16, 2010
- Messages
- 5,832
- Office Version
- 2007
- Platform
- Windows
Ive confused myself & now not sure whats happening.
Can you advise please.
On my worksheet i have cell G13 where it will either be empty or have a customers name present.
I also have 3 checkboxes.
Basically if i select a customer in cell G13 one of the checkboxes should be checked.
If cell G13 has no name present then the 3 checkboxes should not be seen.
So today i have selected a customer in cell G13 & i see that checkbox3 has the checkmark.
I save the file & come back to it later on, now i see no checkmark at all in any 3 checkboxes.
Looking through all my code for the checkboxes i have found the following & this is where ive confused myself.
Just asking if you see the error which is causing this, Many Thanks
Can you advise please.
On my worksheet i have cell G13 where it will either be empty or have a customers name present.
I also have 3 checkboxes.
Basically if i select a customer in cell G13 one of the checkboxes should be checked.
If cell G13 has no name present then the 3 checkboxes should not be seen.
So today i have selected a customer in cell G13 & i see that checkbox3 has the checkmark.
I save the file & come back to it later on, now i see no checkmark at all in any 3 checkboxes.
Looking through all my code for the checkboxes i have found the following & this is where ive confused myself.
Just asking if you see the error which is causing this, Many Thanks
VBA Code:
Private Sub Workbook_Open()
Application.EnableEvents = False
With Sheets("INV")
If Range("G13").Value = "" Then
.CheckBox1 = False
.CheckBox2 = False
.CheckBox3 = False
.Range("G21:G23").Value = ""
.Range("G21").Interior.ColorIndex = 2
.Range("G21:G23").Borders.LineStyle = xlNone
End If
End With
Application.EnableEvents = True
Range("G13:G18,G27:G36,G46:G50").HorizontalAlignment = xlCenter
Range("G13:G18,G27:G36,G46:G50").VerticalAlignment = xlCenter
End Sub
Code:
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Cells.count > 1 Or Target.HasFormula Then Exit Sub
If Not Intersect(Target, Range("L14:L18,G13:G18,G45:G48")) Is Nothing Then
Application.EnableEvents = False
Target = UCase(Target)
Application.EnableEvents = True
End If
If Not Intersect(Target, Range("G13")) Is Nothing Then
Range("G27").Select
End If
If Range("G13").Value = 0 Then
CheckBox1.Visible = False
CheckBox2.Visible = False
CheckBox3.Visible = False
End If
If Range("G13").Value > 1 Then
CheckBox1.Visible = True
CheckBox2.Visible = True
CheckBox3.Visible = True
End If
End Sub