![]() |
Cell Change Alert
Hi,
I have an Excel worksheet called Controls. I need a popup alert that says "Warning: Cell Changed." when cell H9 changes from 1 to 0 or from 0 to 1. I'm not a VBA expert. Any suggestions on the code? Thanking you, GBExcel. -- Message posted via http://www.officekb.com |
Cell Change Alert
The following does **exactly** what you asked, but I can't help feeling
there is more to your question and/or sheet setup than you have told us. Right click the tab at the bottom of the worksheet where you want this functionality at, select View Code from the popup menu that appears and then copy/paste the following into the code window that appears... '*************** START OF CODE *************** Dim OldValue As Variant Private Sub Worksheet_Change(ByVal Target As Range) If Target.Address = "$H$9" Then Select Case Target.Value Case 0 If OldValue = 1 Then MsgBox "Warning: Cell Changed." Case 1 If OldValue = 0 Then MsgBox "Warning: Cell Changed." End Select End If End Sub Private Sub Worksheet_SelectionChange(ByVal Target As Range) OldValue = Target.Value End Sub '*************** END OF CODE *************** -- Rick (MVP - Excel) "GBExcel via OfficeKB.com" <u55438@uwe wrote in message news:9edf2719c0b8e@uwe... Hi, I have an Excel worksheet called Controls. I need a popup alert that says "Warning: Cell Changed." when cell H9 changes from 1 to 0 or from 0 to 1. I'm not a VBA expert. Any suggestions on the code? Thanking you, GBExcel. -- Message posted via http://www.officekb.com |
Cell Change Alert
You are quite right and my ignorance shines through. Your code works
perfectly, but my logic does not. The setup is this: I have an option button with two options on H9. Selecting these options causes the change in values from 0 to 1 or 1 to 0 in cell H9. (Actually, it is 1 to 2, but let's stay with 0 and 1 for consistency's sake.) So selecting the option button should trigger the number change and the alert - or at least that is what my logic thought. As it stands now, if I select H9 with a mouse click and type in a 1 or 2 the alert appears. If I use the option button it does not. Appreciate your help. GBExcel Rick Rothstein wrote: The following does **exactly** what you asked, but I can't help feeling there is more to your question and/or sheet setup than you have told us. -- Message posted via http://www.officekb.com |
All times are GMT +1. The time now is 02:39 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com