View Single Post
  #6   Report Post  
Dave Peterson
 
Posts: n/a
Default

A little setup work first.

rightclick on that spinner and choose format control
on the control tab
Make the current value: 2
minimum value: 1
maximum value: 3
incremental change: 1
and remove the cell link

Then paste this into a general module in the workbook's project:

Option Explicit
Sub IncrementActiveCell()
Dim mySpinner As Spinner
Set mySpinner = ActiveSheet.Spinners(Application.Caller)

With ActiveCell
If IsNumeric(.Value) Then
.Value = .Value + mySpinner.Value - 2
Else
Beep
End If
End With

mySpinner.Value = 2

End Sub

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

Short course:

Open your workbook.
Hit alt-f11 to get to the VBE (where macros/UDF's live)
hit ctrl-R to view the project explorer
Find your workbook.
should look like: VBAProject (yourfilename.xls)

right click on the project name
Insert, then Module
You should see the code window pop up on the right hand side

Paste the code in there.

Then back to excel and rightclick on the spinner.
Choose Assign macro
and assign IncrementActiveCell to the spinner.



Rayco wrote:

Thanks,

Can I take it one step further?

I need to have six counters on one sheet. Instead of creating a form for
each cell, can I somehow set it up so that it will only increment the cell
that has the focus on it?

Thanks,

Rayco

"Biff" wrote in message
...
Hi!

Excel has a "button" made just for this situation. It's called a spinner.

Right click any toolbar and from the list, select Forms.

From the toolbar that appears click on the spinner icon. It looks like an

up
arrow on top of a down arrow.

Get it placed and sized how you want it then right click on it and select
Format Control.

Fill in the info. The cell link will be the cell that you want to increase
(or decrease) when you click the arrows.

Biff

"Rayco" wrote in message
...
Hi,

I'm new to the newsgroup. I hope that someone can help me with a small
challenge.

After reading the through the help sections, I just can't figure it out.

How can I add a "clicker", where every time that I click on a button on

a
sheet, a cell advances 1 number?

My gut feeling is that this is not a simple usage of a formula, but,

then
maybe there is one?

Please help.

Thanks for your help.

Rayco





--

Dave Peterson