U
universal
Apologies for posting again:
Ive tried the following technique for stopping a save when there ar
blank cells. Unfortunately due to the nature of the data Ia
requesting, it is not appropriate for me to use the Exit Sub if it ha
not been correctly filled in.
Therefore Iam using much the same but as a "prompt" on saving tha
there are gaps in the data. It would appear though that Iam getting th
msgbox twice.
Presumably this is because after Cancel=True Iam calling the SaveA
box, any ideas how I might get round this?
Code below:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel A
Boolean)
Dim Blanks As Range
Dim SumBlanks As Double
Set Blanks = Range("aj63:aj263")
SumBlanks = Application.Sum(Blanks)
If SumBlanks > 0 Then
MsgBox "There appears to be some missing or invalid data."
Cancel = True
'Exit Sub
End If
Application.Dialogs(xlDialogSaveAs).Show
End Sub
Many thanks,
Eddi
Ive tried the following technique for stopping a save when there ar
blank cells. Unfortunately due to the nature of the data Ia
requesting, it is not appropriate for me to use the Exit Sub if it ha
not been correctly filled in.
Therefore Iam using much the same but as a "prompt" on saving tha
there are gaps in the data. It would appear though that Iam getting th
msgbox twice.
Presumably this is because after Cancel=True Iam calling the SaveA
box, any ideas how I might get round this?
Code below:
Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel A
Boolean)
Dim Blanks As Range
Dim SumBlanks As Double
Set Blanks = Range("aj63:aj263")
SumBlanks = Application.Sum(Blanks)
If SumBlanks > 0 Then
MsgBox "There appears to be some missing or invalid data."
Cancel = True
'Exit Sub
End If
Application.Dialogs(xlDialogSaveAs).Show
End Sub
Many thanks,
Eddi