Counter

J

J

I have set up a simple manuel counter in a spreadsheet.
It worked just fine, but I need to set up multiple manuel counters
in the same spreadsheet that are independent of each other.
Is there a way to set this up? Also a way to reset
each one of these counters independently?
 
D

Don Guillett

As always, fully tell us what you are talking about and show what you have
already done.
 
J

J

All I've done so far is add a counter using the directions on this webpage:
http://people.revoledu.com/kardi/tutorial/Excel/Iteration.html

The problem is it creates one manuel counter. You are asked to press
F9 to advance the counter, and it also resets the counter to zero also using
the
formula, =IF(D3="",B3,IF(B5<B4,B5+1,B3))

I would like to be able to highlight a cell and press a button so that I can
"add 1"
to the counter.
The problem seems to be that each time I press F9 it counts no matter what
cell I have highlighted, not allowing for more than one counter on a
worksheet because when I put a second counter on the worksheet and pressed F9
they both counted together.

I am a soccer coach looking for a way for my stat person to be able to count
different stats during a game by just clicking on a cell and adding 1 on each
time, for example, a player takes a shot I want the cell counting his totals
shots to increase by one.
I need this to be quick and easy, to make my stat person's life easier.

Thanks,
Josh
 
D

Don Guillett

Right click sheet tab>view code>copy/paste this. Now, when to double click
any cell in col B, the cell count will increase by 1

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)

If Target.Column <> 2 Then Exit Sub
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
Target.Value = Target + 1
Application.EnableEvents = True
End Sub
 
J

J

Thanks a lot man, this helps out a lot!!!

Josh

Don Guillett said:
Right click sheet tab>view code>copy/paste this. Now, when to double click
any cell in col B, the cell count will increase by 1

Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)

If Target.Column <> 2 Then Exit Sub
If Target.Count > 1 Then Exit Sub
Application.EnableEvents = False
Target.Value = Target + 1
Application.EnableEvents = True
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software
(e-mail address removed)
 
J

J

Don,
I have a hiccup.
I did what you said and when I saved the file, and came back to it
later nothing happened.
I am able to use the code in any "new" excel workbook, but any
workbook I come back to later that has been saved and I've exited
out of it will not work.
Is there something else I need to do?

thanks
Josh
 
E

eliano

Don,
I have a hiccup.
I did what you said and when I saved the file, and came back to it
later nothing happened.
I am able to use the code in any "new" excel workbook, but any
workbook I come back to later that has been saved and I've exited
out of it will not work.
Is there something else I need to do?

thanks
Josh






- Mostra testo citato -

Hi J.
Don's Macro use column 2, that is column B, as cells containing your
counters;
be sure to use that column and try this:

' by Don Guillet
Private Sub Worksheet_BeforeDoubleClick _
(ByVal Target As Range, Cancel As Boolean)
If Target.Column <> 2 Then Exit Sub
If Target.Count > 1 Then Exit Sub
If Not IsNumeric(Target) Then Exit Sub
Cancel = True
'Application.EnableEvents = False
Target.Value = Target + 1
'Application.EnableEvents = True
End Sub

Regards and good luck for your team.:))
Eliano
 
J

J

I appreciate the help, but it still hasn't solved my problem.
It works great when I plug the macro in the first time, but as soon as I
save the
workbook and exit out of excel, then reenter back into excel and open up the
file
it won't count anymore.
I haven't got a clue why it's doing this. The macro is still there it's just
not doing
anything.

Thanks,
Josh
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top