My Assistant
![]() ![]() |
|
|
Apr 17 2012, 05:55 PM
Post
#1
|
|
|
UtterAccess Ruler Posts: 1,356 |
i was looking for an example/understanding for using the range reference Target...?
??? thank you. |
|
|
|
Apr 17 2012, 05:56 PM
Post
#2
|
|
|
UtterAccess Certified! Posts: 6,937 From: Arizona, United States |
Well, here is an example at least. If you want to trigger code that watches for cell A2 to change, then you can place this code in the Worksheet_Change event of the worksheet:
CODE Private Sub Worksheet_Change(ByVal Target As Range)
If Target = Range("A1") Then MsgBox "Hi, you just changed cell A1" End If End Sub |
|
|
|
Apr 17 2012, 06:45 PM
Post
#3
|
|
|
UtterAccess VIP Posts: 4,296 |
Target is an argument passed to event code, eg Worksheet_Change, that is a reference to the range that's been changed/selected.
You can use it in the rest of the code. |
|
|
|
Apr 18 2012, 01:43 PM
Post
#4
|
|
|
UtterAccess Ruler Posts: 1,356 |
thank you....
and this example on ozgrid helped: Private Sub Worksheet_Change(ByVal Target As Range) If Not Intersect(Target, Range("A1:A10")) Is Nothing Then MsgBox "Hello" End If End Sub thank you...! |
|
|
|
![]() ![]() |
|
Go to Top · Lo-Fi Version | Time is now: 23rd May 2013 - 07:07 PM |