Excel - increase value at mouse click

Status
Not open for further replies.

atferrari

Well-Known Member
Most Helpful Member
I forgot long time ago the little I knew of VB applied to Excel.

Can anyone give a snippet of VB code to get the value in cell C8 to increase by n every time I click the mouse on cell C9 ?

I recall that being possible but I am clueless now.

Gracias for any help.
 
You can do it on Right Click,
Code:
Private Sub Worksheet_BeforeRightClick(ByVal Target As Range, Cancel As Boolean)
    If Target.Row = 9 And Target.Column = 3 Then
        Cells(8, 3) = Cells(8, 3) + 1
        Cancel = True
    End If
End Sub
This must be in the sheets VB code.

Mike.
 
Mike,

Helpful as usual! Gracias.

I forgot even how to insert that code in Excel. Can you help as well?
 
Here ya go. Open it and press Alt-F11.

Tut, .xls not allowed. So I renamed it .txt

Mike.
 

Attachments

  • clicky.txt
    19 KB · Views: 295
Thanks Pommie. Managed to program two cells to bring the value up and down.

Oh God, how rusty I am in all this!
 
Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…