![]() |
|
|
|||||||
| Excel Questions All Excel/VBA questions - formulas, macros, pivot tables, general help, etc. Please post to this forum in English only. |
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Join Date: Mar 2002
Posts: 364
|
On my spreadsheet Column B has a series of data and every so often there is a blank row (to separate the data). I would like to use column A to place a number next to each data row in column B but, do not want the blank rows to be numbered. I tried to use "FILL" but, it numbered the blank rows.
Please advise. Thx, Noir |
|
|
|
|
|
#2 |
|
Join Date: Feb 2002
Location: Where the wild roses grow
Posts: 285
|
How big do the gaps get? One cell? Two cells? More?
|
|
|
|
|
|
#3 | |
|
MrExcel MVP
Join Date: Feb 2002
Location: The Hague
Posts: 40,551
|
Quote:
=IF(LEN(B2),MAX($A$1:A1)+1,"") where A1 is an empty cell. |
|
|
|
|
|
|
#4 |
|
Join Date: Mar 2002
Posts: 364
|
Thanks Aladin. Worked perfectly!!
Noir |
|
|
|
|
|
#5 |
|
Join Date: Mar 2002
Location: =ActiveCell.Address
Posts: 478
|
Or, if you prefer a VBA approach...
Sub test() Lastrow = Range("B65536").End(xlUp).Row Range("A1").Select MyRow = ActiveCell.Row MyCounter = 1 While MyRow <= Lastrow Range("A" & MyRow).Select If ActiveCell.Offset(0, 1).Value <> "" Then ActiveCell.Value = MyCounter MyCounter = MyCounter + 1 End If MyRow = MyRow + 1 Wend Rgds AJ |
|
|
|
|
|
#6 |
|
Join Date: Mar 2002
Posts: 364
|
AJ how do you initiate your solution?
Noir |
|
|
|
![]() |
| Bookmarks |
| Thread Tools | |
| Display Modes | |
|
|