Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You need to have your code as an event handler.
Go to the code for a sheet (right click a sheet tab). Then Private Sub Worksheet_Change( _ ByVal Target As Excel.Range) Dim x As Integer MsgBox target.address ' didactic If Intersect(Target, Range("a1")) Is Nothing Then Exit Sub x = Range("A1").Value If x = 1 Then MsgBox "invalid number in cell A1" End If End Sub Aaron wrote: Public Sub firsttry() Dim x As Integer x = Range("A1").Value If x = 1 Then MsgBox "invalid number in cell A1" End If End Sub I have to run the macro for the msgbox to appear. How can it pop up as soon as the number 1 is entered in cell A1? |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
simple IF question | Excel Discussion (Misc queries) | |||
IF formula-simple question; simple operator | Excel Discussion (Misc queries) | |||
Simple Simple Excel usage question | Excel Discussion (Misc queries) | |||
simple question, hopefully a simple answer! | Excel Programming | |||
a simple question | Excel Programming |