continuos numbering within a cell

  • Thread starter automatic numbering
  • Start date
A

automatic numbering

Hi,
I was wondering if there is a way to number within a cell automatically with
out having to do alt enter?
ex: 1.
2..etc.

thanks
 
R

Rick Rothstein

You could try this macro (it will ask you how many numbers to insert into
the cell and then do it, auto-fitting the height of the cell afterwards)...

Sub InsertNumbers()
Dim X As Long
Dim HowMany As Long
Dim Counter As String
HowMany = InputBox("How many numbers?")
If IsNumeric(HowMany) Then
For X = 1 To HowMany
Counter = Counter & X
If X < HowMany Then Counter = Counter & vbLf
Next
With ActiveCell
.Cells.WrapText = True
.Value = Counter
.Rows.AutoFit
End With
End If
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top