View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Gord Dibben
 
Posts: n/a
Default Macro Inside Cell

Drop the Sub CellChange()

Drop the last double quote. Good practice also to stick in an error trap to
re-enable events if an error occurs.

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$25" Then
On Error GoTo CleanUp
Application.EnableEvents = False
Target.Value = InputBox("Please enter an Order Number", "Order Number ")
End If
CleanUp:
Application.EnableEvents = True
End Sub


Gord Dibben MS Excel MVP

On Mon, 23 Jan 2006 13:40:21 -0600, dah
wrote:


This appears to be what would work but I get an error message (compile)
that Sub Cellchange() is wrong.


Sub CellChange()
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Address = "$B$25" Then
Target.Value = InputBox("Please enter an Order Number", "Order
Number")
End If

End Sub