View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
papou papou is offline
external usenet poster
 
Posts: 110
Default save on condition

Hello
Place this code into Thisworkbook and amend accordingly:

Private Sub Workbook_BeforeSave(ByVal SaveAsUI As Boolean, Cancel As
Boolean)
With Worksheets("Sheet1")
If .Range("E10").Value < "" And .Range("F10").Value < "" Then
Cancel = False
Else
Cancel = True
MsgBox "Please note input is required into both cells E10 and F10 on sheet
SHEET1"
End If
End With
End Sub

HTH
Cordially
Pascal

"Guye" a écrit dans le message de news:
...
hi all,

i need to creat an excel that prevent the user to save the file unless
he enters data on certain cells, for example
if the user enters data on cell E10 he must also enter data on cell
F10, if he doesnt do that he cant save the file and a msgbox appears
that ask him to enter the missing data.