Hello, I'm hoping that someone can help me. I'm relatively new to VBA and I have a spreadsheet that I'm trying to create multiple macros within. I've been searching for terms, phrases, etc and have come up empty thus far.
The first issue is, this form will be used by multiple people and needs to be able to be saved with the cells empty once I'm done entering all of the required cells macros.
The second portion, "Cells must be filled before save" I've figured out by using the following:
The third issue is I need another "BeforeSave" if cell C15 isn't filled in then C16 needs to be filled before save.
The fourth issue I have is there are multiple dropdowns within the form that need options chosen prior to saving. Example: C8 is a dropdown, the user needs to select one prior to saving.
The final issue that I have is there are multiple checkboxes Yes/No, one or the other needs to be checked. Example: D48 has a form-fill of Checkbox "Yes" and Checkbox "No", one of them needs to be checked before saving.
The first and obvious question is, can these even be done outside of the one I've already figured out? The second question is, does anyone have any guidance or video recommendations that could walk me through this?
Thank you in advance!
The first issue is, this form will be used by multiple people and needs to be able to be saved with the cells empty once I'm done entering all of the required cells macros.
The second portion, "Cells must be filled before save" I've figured out by using the following:
VBA Code:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Application.Sheets("RFQ").Range("D5").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in D5", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("H5").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in H5", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("C31").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in C31", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("C32").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in C32", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("C33").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in C33", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("C35").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in C35", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("C36").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in C36", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("F31").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in F31", vbCritical, "Error!")
Else
If Application.Sheets("RFQ").Range("F32").Value = "" Then
Cancel = True
Response = MsgBox("Please enter a value in F32", vbCritical, "Error!")
End If
End If
End If
End If
End If
End If
End If
End If
End If
End Sub
The third issue is I need another "BeforeSave" if cell C15 isn't filled in then C16 needs to be filled before save.
The fourth issue I have is there are multiple dropdowns within the form that need options chosen prior to saving. Example: C8 is a dropdown, the user needs to select one prior to saving.
The final issue that I have is there are multiple checkboxes Yes/No, one or the other needs to be checked. Example: D48 has a form-fill of Checkbox "Yes" and Checkbox "No", one of them needs to be checked before saving.
The first and obvious question is, can these even be done outside of the one I've already figured out? The second question is, does anyone have any guidance or video recommendations that could walk me through this?
Thank you in advance!
Last edited by a moderator: