M
mikeburg
Need code to increment a number from the cell above in column A when
column A cell is selected. Have tried using the following code but the
number does not increment by 1, it merely copies the number from the
cell above.
(1) Why does the following code not work?
(2) What would be the modification to make the following code work or
what would be the simple code to take the number from above in column
A, add 1, & put it in the selected cell of column A if the selected
cell is blank, empty, or -0-?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
R = Target.Row
If Target.Row > 3 And Target.Column = 1 And Cells(R, 1) = 0 _
And Cells((R - 1), 1).Value > 0 Then
Cells(R, 1).Value = Cells((R - 1), 1).Value + 1
End If
End Sub
Thanks a million. mikeburg
column A cell is selected. Have tried using the following code but the
number does not increment by 1, it merely copies the number from the
cell above.
(1) Why does the following code not work?
(2) What would be the modification to make the following code work or
what would be the simple code to take the number from above in column
A, add 1, & put it in the selected cell of column A if the selected
cell is blank, empty, or -0-?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
R = Target.Row
If Target.Row > 3 And Target.Column = 1 And Cells(R, 1) = 0 _
And Cells((R - 1), 1).Value > 0 Then
Cells(R, 1).Value = Cells((R - 1), 1).Value + 1
End If
End Sub
Thanks a million. mikeburg