This almost does it.It fills in a series in the proper column, but goes the
entire length of the column instead of just the range of cells.
For test, create a workbook with R1C1=²DATA²
Then randomly put data in 10 cells in the column with a few of the interior
cells blank and run the macro.
It should produce a new column with name ³item² in cell r1c1 and serial
numbers in r2:r:11
It produces numbers all the way down.
On 2/13/09 3:01 PM, in article
, "Rick
Rothstein" wrote:
Does this code do what you are trying to do...
Sub AddItemNumber()
Dim LastRow As Long
LastRow = ActiveCell.Offset(, 1).End(xlDown).Offset(, -1).Row
ActiveCell.EntireColumn.Insert
With ActiveCell
.Value = "Item"
.Offset(1).Value = 1
.Offset(1).Resize(LastRow - .Row).DataSeries Rowcol:=xlColumns, _
Type:=xlLinear, Date:=xlDay, Step:=1, Trend:=False
End With
End Sub