Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Button that will increment by 1

I am in the process of trying to create a spreadsheet that will have 5 buttons.
I want to position the button in cell B2, then when pressed it will
increment cell C2 by 1.

Then I need to repeat this 4 times so I'll have buttons and results in cells
B3 & C3, B4 & C4 etc.

I used this code from another thread, Selection.Value = Selection.Value + 1,
but it didn't work for 2 buttons, it incremented the same value whichever
button was pressed.




  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 11,501
Default Button that will increment by 1

Hi,

View|Toolbars|Forms and click the 'Button Icon' and draw a button over B2 by
dragging. As soon as you stop dragging in the popup window click 'New' and
enter this code

Sub Button1_Click()
Range("C2").Value = Range("C2").Value + 1
End Sub

It will already have the first and last lines. Repeat this process for your
other buttons modifying the range C2 as appropriate.

Mike


"Mr-Re Man" wrote:

I am in the process of trying to create a spreadsheet that will have 5 buttons.
I want to position the button in cell B2, then when pressed it will
increment cell C2 by 1.

Then I need to repeat this 4 times so I'll have buttons and results in cells
B3 & C3, B4 & C4 etc.

I used this code from another thread, Selection.Value = Selection.Value + 1,
but it didn't work for 2 buttons, it incremented the same value whichever
button was pressed.




  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 7
Default Button that will increment by 1

Awesome, thank you so much

"Mike H" wrote:

Hi,

View|Toolbars|Forms and click the 'Button Icon' and draw a button over B2 by
dragging. As soon as you stop dragging in the popup window click 'New' and
enter this code

Sub Button1_Click()
Range("C2").Value = Range("C2").Value + 1
End Sub

It will already have the first and last lines. Repeat this process for your
other buttons modifying the range C2 as appropriate.

Mike


"Mr-Re Man" wrote:

I am in the process of trying to create a spreadsheet that will have 5 buttons.
I want to position the button in cell B2, then when pressed it will
increment cell C2 by 1.

Then I need to repeat this 4 times so I'll have buttons and results in cells
B3 & C3, B4 & C4 etc.

I used this code from another thread, Selection.Value = Selection.Value + 1,
but it didn't work for 2 buttons, it incremented the same value whichever
button was pressed.




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Increment Maria Excel Worksheet Functions 4 November 9th 07 12:10 AM
Increment using a button in excel Chuck P. Excel Discussion (Misc queries) 2 July 25th 07 10:06 PM
increment a value by 1 Workshops New Users to Excel 3 March 4th 06 11:06 PM
need to increment value Tom Excel Discussion (Misc queries) 5 June 24th 05 12:54 PM
Set Increment on Spin Button to 0.1 Mark Excel Discussion (Misc queries) 1 March 14th 05 11:22 AM


All times are GMT +1. The time now is 05:10 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"