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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

On click event - cell?

Status
Not open for further replies.

rwttm001

IS-IT--Management
Nov 20, 2002
26
GB
I'm a bit of a newbie with regards to excel vba, what I want to do is to run a piece of code when a certain cell is clicked(thats it!) , but I can't for the life of me figure it out!!!

Sorry, I must be having a bad day....
Matt
 
you need to use the worksheet_selection_change event
Right click on the worksheet and choose "ViewCode"
Choose "Worksheet" from the dropdown box on the left
The selection change sub will automatically be prepared for you
Within there enter

If target.address(0,0) = "A1" then
'run code
else
end if

but swap A1 to whatever cell ref you are referencing. Rgds
Geoff
"Some cause happiness wherever they go; others whenever they go."
-Oscar Wilde
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top