ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding to the cell value with a macro (https://www.excelbanter.com/excel-programming/442011-adding-cell-value-macro.html)

S.S.[_2_]

Adding to the cell value with a macro
 
I would like to select a cell with a product code (let's say cell B6 contains
Part #ABC). I would like to activate that cell, click on a button to run a
macro to change the quantity (lets say quantitiy is in cell A6.) If A6 is
currently 0, a click would change it to 1. if it is 2, a click would change
it to 3. On a sheet with many product numbers, the macro would start at the
active cell, jumpone column to the left, and "1" and return to the cell to
the right. I know this is possible, but can not seem to get there. Thanks in
advance for your help

JLGWhiz[_2_]

Adding to the cell value with a macro
 
Private Sub CommandButton1_Click()
ActiveCell.Offset(0, -1) = ActiveCell.Offset(0 -1).Value + 1
End Sub



"S.S." wrote in message
...
I would like to select a cell with a product code (let's say cell B6
contains
Part #ABC). I would like to activate that cell, click on a button to run
a
macro to change the quantity (lets say quantitiy is in cell A6.) If A6 is
currently 0, a click would change it to 1. if it is 2, a click would
change
it to 3. On a sheet with many product numbers, the macro would start at
the
active cell, jumpone column to the left, and "1" and return to the cell to
the right. I know this is possible, but can not seem to get there. Thanks
in
advance for your help




JLGWhiz[_2_]

Adding to the cell value with a macro
 
Should have mentioned that the code is based on the button being from the
Control Toolbox and should be loaded by right clicking the buttonView Code
to open the code window.


"S.S." wrote in message
...
I would like to select a cell with a product code (let's say cell B6
contains
Part #ABC). I would like to activate that cell, click on a button to run
a
macro to change the quantity (lets say quantitiy is in cell A6.) If A6 is
currently 0, a click would change it to 1. if it is 2, a click would
change
it to 3. On a sheet with many product numbers, the macro would start at
the
active cell, jumpone column to the left, and "1" and return to the cell to
the right. I know this is possible, but can not seem to get there. Thanks
in
advance for your help





All times are GMT +1. The time now is 04:11 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com