Count the number of clicks on 1 cell

Solved
Bruthe -  
lermite222 Posted messages 9042 Status Contributor -
Hello,

So here it is:
I want to be able to click on a cell and have it count the number of clicks made on that cell in another one.

Actually, I have surveys to consolidate (paper version) and to make my work easier, I just want to be able to click on the cell of the selected answer and have it count how many times I clicked on that particular answer.

If I'm not clear, let me know!

And thank you for responding as quickly as you can!

A big thank you in advance.

7 answers

  1. lermite222 Posted messages 9042 Status Contributor 1 199
     
    Hello,
    In the worksheet module, you copy...
    Private Sub Worksheet_SelectionChange(ByVal Target As Range) If Target.Address = "$B$2" Then Range("C2") = Range("C2") + 1 Range("B3").Select End Sub

    When you click on B2, cell C2 records the clicks.
    See you later

    --
    Experience teaches more surely than advice. (André Gide)
    If you knock on a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
    1
  2. lermite222 Posted messages 9042 Status Contributor 1 199
     
    Hello,
    Well... you have "End Sub" twice!!
    See you
    --
    If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
    NOTE: I won't respond to private messages for technical questions.
    1
  3. Bruthe
     
    Thank you, that's great!

    Little problem... I have a multitude of data that I've entered into the relevant fields. It works, it took me some time but it works...
    The problem is B3 which activates automatically and (when I'm at the bottom of the page) goes back to the top of the page (and it's very annoying)

    If you have a solution that would be awesome, otherwise, I'll just make do!

    Thanks again!
    0
  4. lermite222 Posted messages 9042 Status Contributor 1 199
     

    --
    L'expérience instruit plus sûrement que le conseil. (André Gide)
    Si tu te cogne à un pot et que ça sonne creux, c'est pas forcément le pot qui est vide. ;-)(Confucius)
    0
    1. bruthe
       
      That's what I did...

      Thank you and see you very soon!
      0
  5. lermite222 Posted messages 9042 Status Contributor 1 199
     
    According to what I understand, you have a multitude of cells where you need to remember the number of clicks?
    If so, I hope you didn't have to type the IF... a hundred times... ?
    See you later
    --
    Experience teaches more surely than advice. (André Gide)
    If you bump into a pot and it sounds hollow, it's not necessarily the pot that's empty. ;-)(Confucius)
    0
  6. Alex
     
    Hello,

    I also need to count the number of clicks on a certain cell in an Excel file.

    To be honest, I'm a novice in VBA.

    I can get this macro to work, but I can't figure out how to save it.

    When I click "create" for the macro, I name it "comptage" and then paste the code indicated at the beginning of the post.

    This results in:

    Sub comptage()
    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    If Target.Address = "$B$2" Then Range("C2") = Range("C2") + 1
    Range("B3").Select
    End Sub

    End Sub

    In the end, I get the error message "Compile error, Expected End Sub".

    Can you help me?

    Thank you in advance.
    0