View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Norman Jones Norman Jones is offline
external usenet poster
 
Posts: 5,302
Default Reading a cell that a user has clicked on

Hi Aaron,

Try changing

Set TestRange = ThisWorksheet.Range("F13:F18")


to

Set TestRange = Activesheet.Range("F13:F18")


---
Regards,
Norman



"Aaron1978" wrote
in message ...

Thanks man. However, when I click on a cell I get the following error:

Runtime error '424':
Object Required

And it takes me to the lineL


Code:
--------------------

Set TestRange = ThisWorksheet.Range("F13:F18")

--------------------


Any ideas what I'm doing wrong?


Code:
--------------------

Private Sub Worksheet_SelectionChange(ByVal Target As Range)

Dim TestRange As Range
Dim MemoryTestNumber As Single
'Define your test range
Set TestRange = ThisWorksheet.Range("F13:F18")
'Test that the cell selected in within the range you want
Set TestRange = Application.Intersect(Target, MyRange)
'Test if clicked cell is within the given range
If Not TestRange Is Nothing Then MemoryTestNumber = TestRange.Value

PutMemoryTestNumber MemoryTestNumber

End Sub

--------------------


Thanks again,

Aaron


--
Aaron1978
------------------------------------------------------------------------
Aaron1978's Profile:
http://www.excelforum.com/member.php...o&userid=31201
View this thread: http://www.excelforum.com/showthread...hreadid=548156