valendj
08-16-2010, 06:58 AM
Hi,
I am working on a code so the users of the spreadsheet have to fill out all required fields before saving but, I need it to have a trigger if someone imputed data into A1 then that row would have the required fields. Then the next user would input data in A2 and then that row would have the required fields. Up to now all I can figure out is certain cells required. I have been looking through past vbax forum entries and I found a few but, not exactly what I am looking for. Even found one that highlighted the fields the user forgot after the message box appeared which would be great but, one obstacle at a time.
Any help greatly appreciated!
:banghead:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not CheckDateField Then
MsgBox "You Must Fill Out All Highlighted Fields"
Cancel = True
End If
End Sub
Private Function CheckDateField() As Boolean
CheckDateField = False
If Worksheets(1).Range("B2").Value <> "" Then
CheckDateField = True
End If
End Function
Private Function CheckDateFiel() As Boolean
CheckDateField = False
If Worksheets(1).Range("D2").Value <> "" Then
CheckDateField = True
End If
End Function
I am working on a code so the users of the spreadsheet have to fill out all required fields before saving but, I need it to have a trigger if someone imputed data into A1 then that row would have the required fields. Then the next user would input data in A2 and then that row would have the required fields. Up to now all I can figure out is certain cells required. I have been looking through past vbax forum entries and I found a few but, not exactly what I am looking for. Even found one that highlighted the fields the user forgot after the message box appeared which would be great but, one obstacle at a time.
Any help greatly appreciated!
:banghead:
Option Explicit
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As Boolean)
If Not CheckDateField Then
MsgBox "You Must Fill Out All Highlighted Fields"
Cancel = True
End If
End Sub
Private Function CheckDateField() As Boolean
CheckDateField = False
If Worksheets(1).Range("B2").Value <> "" Then
CheckDateField = True
End If
End Function
Private Function CheckDateFiel() As Boolean
CheckDateField = False
If Worksheets(1).Range("D2").Value <> "" Then
CheckDateField = True
End If
End Function