Change cell value with button

mucah!t

Well-known Member
Joined
Jun 27, 2009
Messages
593
Hello,

Like in a calendar I'd like to change the month [in a cell] by pressing the ">" or "<" button.
Any ideas?
 

Excel Facts

How to create a cell-sized chart?
Tiny charts, called Sparklines, were added to Excel 2010. Look for Sparklines on the Insert tab.
Thank you for helping Smitty but I rather don't use a listbox.
I really like to use a "next" and "previous" button to make my excel-form more user friendly.
 
Upvote 0
OK, this approach requires a bit of a workaround, but it should do what you want.

In an unused range enter a list of months in a column and to the left of that add the month numbers. Now you can use a Spin Button control (Forms control, not ActiveX) and link it to an unused cell, setting its Min and Max values to 1 and 12 respectively. Then wherever you want the date to change use VLOOKUP from the Spin Button's linked cell to the list of months. As you click the SpinButton, the number will increment, causing the vlookup to return a different month.

I can send you an example if you want, just PM me your e-mail address.
 
Upvote 0
Sounds good Smitty, I'll give it a try.
First I'd like to try it myself, thanks for offering though ;)
 
Upvote 0
Hello Lenze, I'll give it a try as a workaround like smitty suggested.
I thought there would be a VBA solution for this.
 
Upvote 0
In 2007 I went to Insert, Shapes, Block Arrows, Got the Right and the left, assigning. The Arrows DO NOT APPEAR Belwo as HTML S/W doesn't bring them over but THEY ARE THERE IN MY SAMPLE SHEET, near Cell C4 and E4.
Macros to each (See below)... Works Great!!

Jim
Excel Workbook
ABCDEF
1
2
39/1/2011
4
5
6
Sheet1
Excel 2007

In a standard module:

Code:
Sub RightArrow1_Click()
Range("B3") = WorksheetFunction.EDate(Range("B3"), 1)
End Sub

Sub LeftArrow2_Click()
Range("B3") = WorksheetFunction.EDate(Range("B3"), -1)
End Sub
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,543
Members
452,924
Latest member
JackiG

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top