Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() I want the value of a cell to increase by one every time I push button... is there a short code to do this? th -- Zur ----------------------------------------------------------------------- Zurn's Profile: http://www.excelforum.com/member.php...fo&userid=1464 View this thread: http://www.excelforum.com/showthread.php?threadid=26722 |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
for a commandbutton from the control toolbox toolbar, use the click event.
Private Sub Commandbutton1_Click() Dim ans if isnumeric(Range("A1").Value) then Range("A1").Value = Range("A1").Value + 1 Else ans = Msgbox("Value in A1 is non-numeric; enter 1?", vbYesNo) if ans = vbYes then Range("A1").Value = 1 end if End if End Sub For a forms toolbar button Sub IncrValue() Dim ans if isnumeric(Range("A1").Value) then Range("A1").Value = Range("A1").Value + 1 Else ans = Msgbox("Value in A1 is non-numeric; enter 1?", vbYesNo) if ans = vbYes then Range("A1").Value = 1 end if End if End Sub Assign this macro to the button. -- Regards, Tom Ogilvy "Zurn" wrote in message ... I want the value of a cell to increase by one every time I push a button... is there a short code to do this? thx -- Zurn ------------------------------------------------------------------------ Zurn's Profile: http://www.excelforum.com/member.php...o&userid=14645 View this thread: http://www.excelforum.com/showthread...hreadid=267220 |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() Hi Zurn, Try this Private Sub CommandButton1_Click() Range("A1").Value = Range("A1").Value + 1 End Sub HTH Regards Seamu -- SO ----------------------------------------------------------------------- SOS's Profile: http://www.excelforum.com/member.php...nfo&userid=540 View this thread: http://www.excelforum.com/showthread.php?threadid=26722 |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Independently controlled dates on each worksheet | Excel Discussion (Misc queries) | |||
Data Validation List content controlled from cell | Excel Worksheet Functions | |||
Can xy graph origin be controlled from a cell? | Excel Discussion (Misc queries) | |||
Protecting a worksheet which has button controlled macros | Excel Discussion (Misc queries) | |||
Autoshape in Chart controlled from a different worksheet | Charts and Charting in Excel |