Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Incrementing a cell
Hi, I've created a button on Excel that should add "1" to a particular cell each time it is clicked. This should be very easy, but I'm struggling! I've got the following code: Private Sub CommandButton1_Click() Sheets("Week 1").Range("B3") = + 1 End Sub but this changes to: Private Sub CommandButton1_Click() Sheets("Week 1").Range("B3") = 1 End Sub after the code window is closed. Obviously there is something wrong with the syntax. Please help. Thanks in advance. Anar -- anar_baku ------------------------------------------------------------------------ anar_baku's Profile: http://www.excelforum.com/member.php...o&userid=18259 View this thread: http://www.excelforum.com/showthread...hreadid=392094 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Incrementing a cell
Or:
With Sheets("Week 1").Range("B3") .Value = .Value + 1 End With If the code is to be executed on the active sheet you can use: With Range("B3") .Value = .Value + 1 End With Regards Paul Martin Melbourne, Australia |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Incrementing cell addresses | Excel Worksheet Functions | |||
Incrementing cell reference | Excel Discussion (Misc queries) | |||
incrementing mm/yy based on value in other cell | Excel Worksheet Functions | |||
Incrementing a cell | Excel Programming | |||
Incrementing Cell Numbers | Excel Discussion (Misc queries) |