Conditional checkbox options in Excel form
up vote
0
down vote
favorite
This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.

What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.
Option Explicit
Function checkComplete()
'Dim TextBox1 As OLEObject
If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If
End Function
Sub submitForm()
If checkComplete = False Then Exit Sub
Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add
'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)
For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next
ActiveWindow.ScrollRow = 1
'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"
Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr
'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant
Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")
With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With
Kill TempFilePath & TempFileName & FileExtStr
Set outlook = Nothing
Set outlookMail = Nothing
wbTemp.Activate
wbTemp.Close SaveChanges:=False
thisWb.Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
thisWb.Close SaveChanges:=False
End Sub
excel vba excel-vba
add a comment |
up vote
0
down vote
favorite
This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.

What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.
Option Explicit
Function checkComplete()
'Dim TextBox1 As OLEObject
If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If
End Function
Sub submitForm()
If checkComplete = False Then Exit Sub
Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add
'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)
For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next
ActiveWindow.ScrollRow = 1
'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"
Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr
'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant
Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")
With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With
Kill TempFilePath & TempFileName & FileExtStr
Set outlook = Nothing
Set outlookMail = Nothing
wbTemp.Activate
wbTemp.Close SaveChanges:=False
thisWb.Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
thisWb.Close SaveChanges:=False
End Sub
excel vba excel-vba
1
if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12
@Ferdinando This was very helpful, thank you!
– BetO
yesterday
you are welcome! :)
– Ferdinando
yesterday
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.

What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.
Option Explicit
Function checkComplete()
'Dim TextBox1 As OLEObject
If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If
End Function
Sub submitForm()
If checkComplete = False Then Exit Sub
Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add
'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)
For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next
ActiveWindow.ScrollRow = 1
'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"
Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr
'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant
Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")
With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With
Kill TempFilePath & TempFileName & FileExtStr
Set outlook = Nothing
Set outlookMail = Nothing
wbTemp.Activate
wbTemp.Close SaveChanges:=False
thisWb.Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
thisWb.Close SaveChanges:=False
End Sub
excel vba excel-vba
This question is rather outside my skill range - I've never worked with buttons or checkboxes before in a 'live' form. I've combined two excel forms together to create one main form. While very similar, the form for California has additional options to check for its Provider List Type that the National form does not.

What I would like to be able to do is select California at the top, and have Regional Provider List and California Full List (CD) be available as options, whereas if I select National, they are not available. Lots of different people will use this form so I need to ensure they can't click whatever they want. I'm not a strong coder, someone else built the forms, I just frankensteined them together. Most of the solutions I've encountered that I can understand are for ActiveX controls and I've used simple Form controls. I also apologize for posting the entire code, I'm not entirely sure where to insert the checkbox control code. If anyone has a good resource on this subject for newbies they can recommend, I would be very appreciative to digest it.
Option Explicit
Function checkComplete()
'Dim TextBox1 As OLEObject
If IsEmpty(Range("I6")) Then
MsgBox "Please enter the Claimant Name."
Range("I6").Select
checkComplete = False
ElseIf IsEmpty(Range("I8")) Then
MsgBox "Please enter the Claim #."
Range("I8").Select
checkComplete = False
ElseIf IsEmpty(Range("AF6")) Then
MsgBox "Please enter the Date that the list is needed by."
Range("AF6").Select
checkComplete = False
'ElseIf TextBox1.Text = "" Then
'MsgBox "Please enter a description."
'TextBox1.Select
'checkComplete = False
Else
checkComplete = True
End If
End Function
Sub submitForm()
If checkComplete = False Then Exit Sub
Dim thisWb As Workbook, wbTemp As Workbook
Dim ws As Worksheet
Application.ScreenUpdating = False
Application.DisplayAlerts = False
Application.EnableEvents = False
Set thisWb = ThisWorkbook
Set wbTemp = Workbooks.Add
'Save Network Development Form worksheet to new workbook.
'Needs to be copied from an xltm to an xlsx workbook in order to email a good xlsx file that is not corrupt.
thisWb.Sheets(1).Copy After:=wbTemp.Sheets(3)
For Each ws In wbTemp.Worksheets
If ws.Name <> "Network Development Form" Then
ws.Delete
End If
Next
ActiveWindow.ScrollRow = 1
'Save temporary copy of workbook
Dim TempFilePath As String
Dim TempFileName As String
Dim FileExtStr As String
TempFilePath = Environ$("temp") & ""
TempFileName = "Network Development - Claim#" & Range("I8").Value
FileExtStr = ".xlsx"
Set wbTemp = ActiveWorkbook
wbTemp.SaveCopyAs TempFilePath & TempFileName & FileExtStr
'Email copy of form to Networks
Dim outlook As Object
Dim outlookMail As Object
Dim UName As Variant
Set outlook = CreateObject("Outlook.Application")
Set outlookMail = outlook.CreateItem(0)
UName = Environ("UserName")
With outlookMail
.To = ""
.CC = UName & "@auw.com"
.Subject = "Network Development Form"
.Attachments.Add TempFilePath & TempFileName & FileExtStr
.Send '.Display
End With
Kill TempFilePath & TempFileName & FileExtStr
Set outlook = Nothing
Set outlookMail = Nothing
wbTemp.Activate
wbTemp.Close SaveChanges:=False
thisWb.Activate
Application.ScreenUpdating = True
Application.DisplayAlerts = True
Application.EnableEvents = True
thisWb.Close SaveChanges:=False
End Sub
excel vba excel-vba
excel vba excel-vba
asked Nov 9 at 15:06
BetO
213
213
1
if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12
@Ferdinando This was very helpful, thank you!
– BetO
yesterday
you are welcome! :)
– Ferdinando
yesterday
add a comment |
1
if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12
@Ferdinando This was very helpful, thank you!
– BetO
yesterday
you are welcome! :)
– Ferdinando
yesterday
1
1
if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12
if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12
@Ferdinando This was very helpful, thank you!
– BetO
yesterday
@Ferdinando This was very helpful, thank you!
– BetO
yesterday
you are welcome! :)
– Ferdinando
yesterday
you are welcome! :)
– Ferdinando
yesterday
add a comment |
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
active
oldest
votes
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228275%2fconditional-checkbox-options-in-excel-form%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
1
if i understood your question you can read this post stackoverflow.com/questions/11991308/… to use checkboxe and display that you want...
– Ferdinando
Nov 11 at 21:12
@Ferdinando This was very helpful, thank you!
– BetO
yesterday
you are welcome! :)
– Ferdinando
yesterday