Hi Guys,
I have the below code and I think it is correct but it doesn't seem to call any subs when I hit OK if the checkboxes are checked. The other issue is when I hit okay and nothing is typed in the analyst name textbox, this comes up with a warning msg, as it should do, however whenever I leave one of the others blank it displays error messages for all the textboxes being blank even if they are not!
Just as an FYI, I have the checkboxes enter a value of true or false respectively into a spreadsheet next to the respective name, this is then copied next to it when you hit okay to remember the settings in case the user reopens the form changes the checkboxes and hits cancel. Cancel copies the saved options over the referenced ones for the subs to be called
Any ideas would be really handy!
Private Sub CheckBoxCUST_Click()
If CheckBoxCUST.Value = True Then
Sheets("VBA inputs").Range("B3").Value = "TRUE" 'Check
Else
Sheets("VBA inputs").Range("B3").Value = "FALSE" 'UnCheck
End If
End Sub
Private Sub CheckBoxSUP_Click()
If CheckBoxSUP.Value = True Then
Sheets("VBA inputs").Range("B2").Value = "TRUE" 'Check
Else
Sheets("VBA inputs").Range("B2").Value = "FALSE" 'UnCheck
End If
End Sub
Private Sub CheckBoxTRANS_Click()
If CheckBoxTRANS.Value = True Then
Sheets("VBA inputs").Range("B4").Value = "TRUE" 'Check
Else
Sheets("VBA inputs").Range("B4").Value = "FALSE" 'UnCheck
End If
End Sub
Private Sub CANCEL_Click()
Dim VBAinp As Worksheet
Dim CUST As Range
Dim SUP As Range
Dim Trans As Range
Set VBAinp = Sheets("VBA inputs")
Set CUST = VBAinp.Range("B2")
Set SUP = VBAinp.Range("B3")
Set Trans = VBAinp.Range("B4")
ToolSelec.Hide
VBAinp.Range("C2:C4").Copy Destination:=Sheets("VBA inputs").Range("B2:B4")
If CUST.Value = "True" Then
CheckBoxCUST.Value = True 'Check
ElseIf CUST.Value = "FALSE" Then
CheckBoxCUST.Value = False 'UnCheck
End If
If SUP.Value = "True" Then
CheckBoxSUP.Value = True 'Check
ElseIf SUP.Value = "FALSE" Then
CheckBoxSUP.Value = False 'UnCheck
End If
If Trans.Value = "True" Then
CheckBoxTRANS.Value = True 'Check
ElseIf Trans.Value = "FALSE" Then
CheckBoxTRANS.Value = False 'UnCheck
End If
Sheets("Transaction").Activate
End Sub
Private Sub ButtonOK_Click()
Dim VBAinp As Worksheet
Dim CUST As Range
Dim SUP As Range
Dim Trans As Range
Set VBAinp = Sheets("VBA inputs")
Set CUST = VBAinp.Range("B3")
Set SUP = VBAinp.Range("B2")
Set Trans = VBAinp.Range("B4")
ToolSelec.Hide
VBAinp.Range("B2:B4").Copy Destination:=VBAinp.Range("C2:C4")
If CUST.Value = "true" Then
'Call Customers
End If
If SUP.Value = "TRUE" Then
Call Suppliers
End If
If Trans.Value = "TRUE" Then
Call Transaction_Freq
End If
End Sub
Bookmarks