View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips[_6_] Bob Phillips[_6_] is offline
external usenet poster
 
Posts: 11,272
Default Simulate Access' After Update Event

This sounds like you you want the worksheet change event. An outline example

Option Explicit

Private Sub Worksheet_Change(ByVal Target As Range)
Const WS_RANGE As String = "H1:H10"

On Error GoTo ws_exit:
Application.EnableEvents = False
If Not Intersect(Target, Me.Range(WS_RANGE)) Is Nothing Then
With Target
'do your stuff
End With
End If

ws_exit:
Application.EnableEvents = True
End Sub

'This is worksheet event code, which means that it needs to be
'placed in the appropriate worksheet code module, not a standard
'code module. To do this, right-click on the sheet tab, select
'the View Code option from the menu, and paste the code in.


--
HTH

Bob Phillips

(remove nothere from email address if mailing direct)

"MChrist" wrote in message
...
Is there a way to simulate Access' After Update event in an Excel
spreadsheet? For example, if I had a column and someone entered a value

into
it, can I write a routine to check the data and run other macros?

I realize that's not very clear and I know Excel has validation boxes, but
let's say I have a sheet that I want people to put an ID in the first

column
of, the routine should check that the ID hasn't been previously used and
should populate the name, address... fields.

I'm not asking for anything that perfect to exist, but if someone could
either copy me a code chunk or point me to a good example online I would
really appreciate it.

TIA

Mark