Hi all,
Is there any way in VBA it make the value of any cell that is clicked on available to be used in the code. For example, if you had a range of numbers and the user clicked on any one of the cells; that value they clicked on would then be available to be used in VBA, such as in a function. Below is what I'm trying to achieve.
The Sub and function below are in a module. The idea is that the cell that the user clicks on is placed into memory and becomes available to be used any where.
---------------------
Sub PutMemoryTestNumber(NewMemoryTestNumber As Single)
sngMemoryTestNumber = NewMemoryTestNumber
End Sub
Function fnMemoryTestNumber() As Single
fnMemoryTestNumber = sngMemoryTestNumber
End Function
--------------------
The subroutine below is in the form where the user clicks on the cell.
--------------------
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
PutMemoryTestNumber THIS IS WHERE I WOULD LIKE TO ADD THE VALUE OF THE CELL THAT THE USER HAS CLICKED ON
End Sub
-------------------
The cell that the user has clicked on would be placed into the subroutine PutMemoryTestNumber which would then be available to the function.
Does this make sense?
Any help would be greatly appreciated.
Best Regards,
Aaron
Bookmarks