Command button to increment a cell by 0.1
Command button to increment a cell by 0.1
(OP)
how do I
increment Cell by .01
ie
start
k2=k2+.01
end
increment Cell by .01
ie
start
k2=k2+.01
end
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS Come Join Us!Are you an
Engineering professional? Join Eng-Tips Forums!
*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail. Posting GuidelinesJobs |
Command button to increment a cell by 0.1
|
RE: Command button to increment a cell by 0.1
Range("K2").Value = Range("K2").Value + 0.01
If you want to access the cell position in code, use the Cells object:
Cells(2, 11).Value = Cells(2, 11).Value + 0.01
Good Luck
johnwm
________________________________________________________
To get the best from these forums read FAQ731-376 before posting
UK steam enthusiasts: www.essexsteam.co.uk
RE: Command button to increment a cell by 0.1
Sub add_to_it()
ActiveCell.Value = ActiveCell.Value + 0.1
End Sub
RE: Command button to increment a cell by 0.1
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Target
.Value = .Value + 0.01
End With
Cancel = True
End Sub
double clicking any cell will increment it by 0.01
You can refine the event procedure by exiting quickly if the target cell is not one of interest. For example suppose only cells A1:A10 should be incremented then use the following
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
If Intersect(Target, Range("A1:A10")) Is Nothing Then Exit Sub
With Target
.Value = .Value + 0.01
End With
Cancel = True
End Sub
RE: Command button to increment a cell by 0.1
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
With Target
If IsNumeric(.Value) then .Value = .Value + 0.01
End With
Cancel = True
End Sub