LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Increment numbers in column A by 1 when selected


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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Why Excel Does not increment by 2 or 3, odd/even numbers? alsaleh Excel Worksheet Functions 6 November 16th 09 02:06 AM
Automatically Increment Row Numbers Jen New Users to Excel 9 November 19th 08 08:25 AM
how to sort a column of Randomly selected numbers? Khoshravan Excel Worksheet Functions 8 July 14th 07 08:16 PM
Increment numbers in a column Liz Excel Discussion (Misc queries) 4 August 9th 05 02:10 PM
Add selected numbers in a column that are a different color Sam Excel Discussion (Misc queries) 6 March 4th 05 11:46 PM


All times are GMT +1. The time now is 07:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"