Sunday, August 23, 2015

Excel VBA - Run macro if cell in range is clicked and selected

I need a routine that can identify if a cell was clicked in a range and then run a macro. I've got this solved partly.



My problem is:
I need to toggle a value whenever the cell is clicked, not whenever the cell is selected, so




Private Sub Worksheet_SelectionChange(ByVal Target As Range)    

If Not Intersect(Target, Range(testRange) Is Nothing Then
'Cell was Clicked
End If

End Sub



does only work for me as long the cell is not selected.



What can I do? Is there a function to check if a mouse click was performed and the cell selected?

No comments:

Post a Comment

linux - How to SSH to ec2 instance in VPC private subnet via NAT server

I have created a VPC in aws with a public subnet and a private subnet. The private subnet does not have direct access to external network. S...