ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   How can I auto number rows only when data is entered in the same r (https://www.excelbanter.com/excel-discussion-misc-queries/243014-how-can-i-auto-number-rows-only-when-data-entered-same-r.html)

Plateav

How can I auto number rows only when data is entered in the same r
 
I'm working with Microsoft Office 2003. Is there anyway I can auto number
rows (in sequence) in column A ONLY when data is entered in column B? 9 cool
points for the first correct answer. THANKS! (0:

Luke M

How can I auto number rows only when data is entered in the same r
 
Using a formula:

=IF(B2="","",A1+1)
copied down as far as you would ever need to go.

Using VB:
Right click on sheet tab, view code, paste this in:

'=======
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
Target.Offset(0, -1).Value = Target.Offset(-1, -1).Value + 1
End Sub
'=======
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Plateav" wrote:

I'm working with Microsoft Office 2003. Is there anyway I can auto number
rows (in sequence) in column A ONLY when data is entered in column B? 9 cool
points for the first correct answer. THANKS! (0:


Dave Peterson

How can I auto number rows only when data is entered in the same r
 
You could use a formula in column A that makes it look like an empty row until
something appears in column B. But you'll have to copy it down the column as
far as you need:

=if(b1="","",row())

(This assumes that no rows in column B are skipped.)

Plateav wrote:

I'm working with Microsoft Office 2003. Is there anyway I can auto number
rows (in sequence) in column A ONLY when data is entered in column B? 9 cool
points for the first correct answer. THANKS! (0:


--

Dave Peterson

Plateav

How can I auto number rows only when data is entered in the sa
 
Luke! Poets will write songs about you one day! PERFECTO!!!

"Luke M" wrote:

Using a formula:

=IF(B2="","",A1+1)
copied down as far as you would ever need to go.

Using VB:
Right click on sheet tab, view code, paste this in:

'=======
Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Range("B:B")) Is Nothing Then Exit Sub
Target.Offset(0, -1).Value = Target.Offset(-1, -1).Value + 1
End Sub
'=======
--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"Plateav" wrote:

I'm working with Microsoft Office 2003. Is there anyway I can auto number
rows (in sequence) in column A ONLY when data is entered in column B? 9 cool
points for the first correct answer. THANKS! (0:



All times are GMT +1. The time now is 02:41 PM.

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