Row Numbering dependant on amount in a cell

M

Monkey

Hi there,

I am creating a Spreadsheet that calculates sample sizes depending on a
number of criteria. Once the size has been established in a cell I want that
number of rows to be numbered on another sheet starting at row 10. Does
anyone know if I am able to achive this?

Many thanks for your time!
 
M

Mike

Sub numberRows()
Const cellValue As String = "E1"
r = 10
If IsNumeric(Worksheets("Sheet1").Range(cellValue).Value) Then
For i = 1 To Worksheets("Sheet1").Range(cellValue).Value
Worksheets("Sheet2").Range("A" & r).Value = i
r = r + 1
Next
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