Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]() 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 -- mikeburg ------------------------------------------------------------------------ mikeburg's Profile: http://www.excelforum.com/member.php...o&userid=24581 View this thread: http://www.excelforum.com/showthread...hreadid=536399 |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Why Excel Does not increment by 2 or 3, odd/even numbers? | Excel Worksheet Functions | |||
Automatically Increment Row Numbers | New Users to Excel | |||
how to sort a column of Randomly selected numbers? | Excel Worksheet Functions | |||
Increment numbers in a column | Excel Discussion (Misc queries) | |||
Add selected numbers in a column that are a different color | Excel Discussion (Misc queries) |