ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   help (https://www.excelbanter.com/excel-programming/288722-help.html)

jeff

help
 
Anyone konw how to do the following:
I have a row of cells each containing a whole number
value that must be decreased by 1 on a daily basis. I
want to assign a macro to a button that when clicked,
will subtract a value of one from each indivdual cell
that it is included in a group of highlighted cells.

Can this be done?

Anders S[_2_]

help
 
Jeff,

-----

Sub test593()
Dim cCell As Range
For Each cCell In Selection.Cells
If IsEmpty(cCell.Value) = True Then GoTo nextCell
If IsNumeric(cCell.Value) = False Then GoTo nextCell
cCell.Value = cCell.Value - 1
nextCell:
Next
End Sub

-----

HTH
Anders Silven

"jeff" skrev i meddelandet ...
Anyone konw how to do the following:
I have a row of cells each containing a whole number
value that must be decreased by 1 on a daily basis. I
want to assign a macro to a button that when clicked,
will subtract a value of one from each indivdual cell
that it is included in a group of highlighted cells.

Can this be done?



All times are GMT +1. The time now is 09:06 PM.

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