Hi, im doing an app in excel VBA. I need to be know what cell the user has clicked on...cant remember how do do this...help please
thanks in advance
Printable View
Hi, im doing an app in excel VBA. I need to be know what cell the user has clicked on...cant remember how do do this...help please
thanks in advance
There is an event that gets called when the selection changes. It passes a range object that contains the selected cell(s)
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
End Sub
it works;)
Yes, do like this...
VB Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) msgbox ActiveCell.Address, VBInformation, "Weeeeee!!!" End Sub
And here is how I find out if a cell is one I want to use to call a procedure when clicked on, well ok, I admit it, i make buttons out of cells...<sob>
VB Code:
Private Sub Worksheet_SelectionChange(ByVal Target As Range) If ActiveCell.Address = "$B$1" Then Call CoolNiftyAndHandyProcedure End Sub