Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

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: 285
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.

Latest threads

New Articles From Microcontroller Tips

Back
Top