How to select Cell address between Specified Range

G

Guest

If user click between Range("A1:A10") only then i would like to return the
address of the selected cell for calculation purpose. Is it possible in vba ?
 
J

JW

Look at the Selection_Change event of the worksheet where you want
this to happen:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A10")) _
Is Nothing Then MsgBox Target.Address
End Sub
 
G

Guest

and here is another interpretation:

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Selection, _
Range("A1:A10")) Is Nothing Then
MsgBox Target.Address
End If
End Sub

Right click on the sheet tab and select view code - then paste in the above.
 
G

Guest

Thanx JW,
Your solution solve my problem.


JW said:
Look at the Selection_Change event of the worksheet where you want
this to happen:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Not Intersect(Target, Range("A1:A10")) _
Is Nothing Then MsgBox Target.Address
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top