Table creation help please

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have to create a worksheet for a highway design class. I need to be able to
create a table between certain chainage stations.

example:
I need to create a table starting from 10+000 to 12+000 at 20 metre intervals.

Is this possible so a table is created with a column of station numbers
10+000, 10+020, 10+040, 10+060....... 11+080, 12+000.

Any help or ideas is greatly appreciated.
 
One way, with a macro:

Sub CreateStations()

Const FirstPartLower = 10
Const FirstPartUpper = 11
Const SecondPartLower = 0
Const SecondPartUpper = 80
Const FinalPart = 12
Dim i As Long
Dim j As Long
Dim k As Long

k = 1

For i = FirstPartLower To FirstPartUpper Step 1
For j = SecondPartLower To SecondPartUpper Step 20
Range("A" & k) = _
Application.WorksheetFunction.Text(i, "00") & _
"+" & _
Application.WorksheetFunction.Text(j, "000")
k = k + 1
Next j
Next i

Range("A" & k) = _
Application.WorksheetFunction.Text(FinalPart, "00") & _
"+" & _
Application.WorksheetFunction.Text(0, "000")

End Sub


Adjust the constants as required

Regards

Trevor
 

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

Back
Top