Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OnClick Event for an Excel cell?

Status
Not open for further replies.

daveh

Technical User
Jun 22, 2000
57
GB
Hi,

I have a column which has comments in it (block text). I have a user form at the moment that opens when the users does a certain keyboard shortcut, which places the contents of the active cell into a multiline text box, and the user can then edit it easily in that, and click on UPDATE which puts the contents of the text box back into the active cell, and closes the form... this works great.

What I need is a way for the user to be able to launch the macro by just clicking the cell in question, rather than having to launch the macro by a keyboard shortcut. I don't really want to have to add a button at the end of every row. I suppose I'm asking for a cell "on click" event, or if not a hyperlink to a macro.

All the macro needs to do is to open the form, so if there's a way to do this through the hyperlink/onclick thing that can't use a macro, it doesn't matter, as long as it opens up the user form.

Thanks for your help in advance.

Dave.
 
Hi Dave,

Not entirely sure what you're trying to achieve here, but the Worksheet Selection Change Event should enable it for you. Put your code in the Worksheet's code module something like this ..

Code:
[blue]Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    MsgBox "You clicked on cell " & Target.Address
End Sub[/blue]

Enjoy,
Tony

--------------------------------------------------------------------------------------------
We want to help you; help us to do it by reading this: Before you ask a question.
Excel VBA Training and more Help at [url=http://www.vbaexpress.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top