Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Worksheet_BeforeClose conditional Worksheet change

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

--
PerNorman
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Worksheet_BeforeClose conditional Worksheet change

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.

"Per" wrote:

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

--
PerNorman

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10
Default Worksheet_BeforeClose conditional Worksheet change

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
--
PerNorman


"JLGWhiz" wrote:

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.

"Per" wrote:

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

--
PerNorman

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Worksheet_BeforeClose conditional Worksheet change

Here are some web sites that will give you more information on using event
procedures. They also provide sample code which you can use to construct a
procedure that fits your needs.

http://www.mvps.org/dmcritchie/excel/event.htm

http://msdn2.microsoft.com/en-us/lib...ffice.10).aspx

http://www.cpearson.com/excel/Events.aspx

"Per" wrote:

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
--
PerNorman


"JLGWhiz" wrote:

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.

"Per" wrote:

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

--
PerNorman

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Conditional formatting does not change when values change. ?? Texana Excel Worksheet Functions 4 August 20th 07 12:20 AM
Conditional formatting or worksheet change event? bearsfan Excel Programming 3 October 25th 06 06:23 PM
Change conditional formatting to coloured alternate rows dependent on a change in date? StargateFan[_3_] Excel Programming 4 August 2nd 06 11:28 AM
Conditional Formating on Worksheet Change Barb Reinhardt Excel Programming 10 June 28th 06 08:23 PM
Change Cell from Validated List Not Firing Worksheet Change Event [email protected] Excel Programming 3 October 4th 04 03:00 AM


All times are GMT +1. The time now is 11:28 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"