Function addsheets(station)
Worksheets.Add after:=Sheets(Sheets.Count) '在所有表最右边插入一表
ActiveSheet.Name = station '表名
End Function
Sub gateway()
Dim station, column1, column2, column3, column4 As String
column1 = 10
column4 = 1
Dim row_station_start, row_station_end, row_contractor_start, row_contractor_end As Integer
Dim i, j, k As Integer
k = 1
row_station_start = 12
row_station_end = 25
row_contractor_start = 31
row_contractor_end = 51
For i = row_station_start To row_station_end
station = Worksheets("Sheet1").Cells(i, 1)
column2 = Worksheets("Sheet1").Cells(i, 2)
addsheets (station)
For j = row_contractor_start To row_contractor_end
column3 = Worksheets("Sheet1").Cells(j, 3)
Cells(k, 1) = Worksheets("Sheet1").Cells(j, 1)
Cells(k, 2) = Worksheets("Sheet1").Cells(j, 2)
If column3 <> "" Then
Cells(k, 3) = column1 & "." & column2 & "." & column3 & "." & column4
End If
k = k + 1
Next j
k = 1
Next i
End Sub