Which data have been entered into a cell ?

  • Thread starter Thread starter hglamy
  • Start date Start date
H

hglamy

Hello there,

I need to react to the data that a user may enter into
certain cells (XL XP).

How can I programmatically catch the entry that has
been made ?

Help greatly appreciated.

Kind regards,

H.G. Lamy
 
HG,

You need the Worksheet_Change event.

You test for what has been entered by testing the Target argument. For
instance, if you want to react to all changes in column N, use

If Target.Column = 14 Then

If you want to test for cells B5:G7 say, use

If (Not Intersect(Target,Range("B5:G7")) Is Nothing) Then

and then do your stuff.

As this is worksheet code, it goes into the worksheet code module.


--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)
 
Use the Change event procedure in the Sheet's code module. E.g.,

Private Sub Worksheet_Change(ByVal Target As Range)
Select Case Target.Address
Case "$A$1", "$B$2", "$C$3"
MsgBox "You changed one of these cells"
Case Else
MsgBox "You changed cell " & Target.Address
End Select
End Sub


--
Cordially,
Chip Pearson
Pearson Software Consulting, LLC
Microsoft MVP - Excel
www.cpearson.com (e-mail address removed)
 
Thank you !

I had tried to work with the "Selection_Change" event,
but with "Worksheet_Change" you pointed me to the right direction !

Kind regards,

H.G. Lamy
 
Back
Top