Worksheet_BeforeClose conditional Worksheet change

  • Thread starter Thread starter Per
  • Start date Start date
P

Per

Trying to make the following macro dependant on any change in the active
worksheet. In other words it should not be inaugerated if the the file just
is opened for view or printing, but only when any cell in the sheet is
changed. Can worksheet change be used? Does anybody have a solution?

Sub Workbook_BeforeClose(cancel As Boolean)
If Sheets("INKÖP").Range("C3").Value > Range("C2") Then
If MsgBox("Revisionsdatum ej uppdaterat! Uppdatera nu?", _
vbCritical + vbYesNo, _
"OBS! revisionsdatum") = vbYes Then cancel = True
End If
End Sub
 
Hello Per, If you use the Worksheet_Change method, you would have to put the
code in each worksheet code module, and it would fire on any change at at all.
Or You could use the Workbook_SheetChange method which would fire when a
change is made to any sheet except a chart sheet. Check the VBA help files
for more information on these two change events.
 
Thank you, will try to consult the VBA help for this. I am not a VBA
programmer but work with quality management. May come back for further advice.
Many thanks
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top