PC Review


Reply
Thread Tools Rate Thread

Adding one to the current value in a cell

 
 
mitchbryan@hotmail.co.uk
Guest
Posts: n/a
 
      2nd Mar 2007
Hi,

I'm trying to set something up that enables me to press a button and
the numeric value in a cell will increase by one. I don't want this
cell to relate to another cell, just if, say, the value in the cell
was 1 and I pressed a key it would increase to 2 and if I pressed the
key again it would increase to 3 and so on...

Can anyone help me?

Mitch

 
Reply With Quote
 
 
 
 
=?Utf-8?B?TWFkaGFu?=
Guest
Posts: n/a
 
      2nd Mar 2007
Hi, try the following code snippet, cells(1,1).value = cells(1,1).value+1.
This will increment the value at row 1 and column 1 by 1. Include this
snippet within the code that will be called when a button is pressed.

"(E-Mail Removed)" wrote:

> Hi,
>
> I'm trying to set something up that enables me to press a button and
> the numeric value in a cell will increase by one. I don't want this
> cell to relate to another cell, just if, say, the value in the cell
> was 1 and I pressed a key it would increase to 2 and if I pressed the
> key again it would increase to 3 and so on...
>
> Can anyone help me?
>
> Mitch
>
>

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      2nd Mar 2007
right click sheet tab>view code>insert this>
Now, if you double click cell a5 or a6 the cell clicked will increase by
one. Is that what you want?

Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As
Boolean)
If Target.Address = "$A$5" Or Target.Address = "$A$6" Then
On Error GoTo fixit
Application.EnableEvents = False
If Target.Value = 0 Then oldvalue = 0
Target.Value = 1 * Target.Value + 1
oldvalue = Target.Value
fixit:
Application.EnableEvents = True
End If
Cancel = True
End Sub

--
Don Guillett
SalesAid Software
(E-Mail Removed)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi,
>
> I'm trying to set something up that enables me to press a button and
> the numeric value in a cell will increase by one. I don't want this
> cell to relate to another cell, just if, say, the value in the cell
> was 1 and I pressed a key it would increase to 2 and if I pressed the
> key again it would increase to 3 and so on...
>
> Can anyone help me?
>
> Mitch
>



 
Reply With Quote
 
mitchbryan@hotmail.co.uk
Guest
Posts: n/a
 
      2nd Mar 2007
Hi again,

Thankyou both for your help that's great and has solved my problem,

Mitch

 
Reply With Quote
 
Don Guillett
Guest
Posts: n/a
 
      2nd Mar 2007
Although you didn't say what you used, glad to help

--
Don Guillett
SalesAid Software
(E-Mail Removed)
<(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> Hi again,
>
> Thankyou both for your help that's great and has solved my problem,
>
> Mitch
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Date in cell keeps adding the current year. Excelsior731 Microsoft Excel Misc 6 13th Apr 2009 05:51 PM
Adding current date and contents of a cell in the footer Carl Microsoft Excel Programming 3 6th Feb 2008 01:39 PM
Adding days expired in current year and days remaining in current =?Utf-8?B?cHJlem9uZWRheQ==?= Microsoft Outlook Calendar 1 2nd Feb 2007 01:26 AM
change current cell colour based on the value of adjacent cell on other worksheet Rits Microsoft Excel Programming 2 23rd Nov 2006 11:57 AM
get the value of a formula in cell B1 into cell A1 without changing my current cell selection News Microsoft Excel Programming 3 21st Oct 2006 12:24 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:09 AM.