In article <BD390CF8.7985%fh.2.net@ntlworld.com>,
Francis Hookam <fh.2.net RemoveThis @ntlworld.com> wrote:
> Entries in C2 (starting at a specifiable row, in this instance R11) are
> numbered consecutively (1, 2, 3, 4, etc) in C1
>
> Traditionally I generate the numbers manually by typing 1 in R11C1 and 2 in
> R12C1 and then selecting both and dragging down as far as necessary - ok, it
> may show my age (Multiplan and all that), but there must be a slicker way
>
> =1+R[-1]C is no good because I have to insert/remove rows from time to time
> and so need a macro to quickly renumber C1, first finding out how far down
> C2 extends
I agree with Bob that fill down is pretty slick. Having said that,
however, I have a separate testing toolbar that I use to generate a
range of lists (sequential by 1s, 2,s 5s, 10s, etc., random integers,
random decimals, SSNs, mixed Alphanumeric, etc.). The specific macros I
use wouldn't be of much interest, but you could attach a macro like this
to a toolbar button (or, as Bob said, to a keyboard shortcut) to fill
the first column of the selection:
Public Sub FillFirstColumn()
Dim vArr As Variant
Dim i As Long
With Selection
ReDim vArr(1 To .Rows.Count)
For i = 1 To UBound(vArr)
vArr(i) = i
Next i
.Columns(1).Value = Application.Transpose(vArr)
End With
End Sub<!-- ~MESSAGE_AFTER~ -->
>> Stay informed about: Consecutive numbering