|
- Private Sub CommandButton1_Click()
- Dim i As Long, bj As String, rng As Range
- i = 3
- bj = Worksheets("数据").Cells(i, "A").Value
- Do While bj <> ""
- Worksheets("模板").Copy after:=Worksheets(i - 1)
- Worksheets(i).Cells(4, "B").Value = Worksheets("数据").Cells(i, "A").Value
- Worksheets(i).Cells(4, "E").Value = Worksheets("数据").Cells(i, "E").Value
- Worksheets(i).Cells(6, "B").Value = Worksheets("数据").Cells(i, "G").Value
- Worksheets(i).Cells(6, "E").Value = Worksheets("数据").Cells(i, "F").Value
- Select Case Worksheets("数据").Cells(i, "H").Value
- Case Is = "火车"
- Worksheets(i).Cells(8, "C").Value = Worksheets("数据").Cells(i, "A").Value
- Worksheets(i).Cells(8, "E").Value = Worksheets("数据").Cells(i, "B").Value
- Worksheets(i).Cells(9, "E").Value = Worksheets("数据").Cells(i, "C").Value
- Case Is = "航空"
- Worksheets(i).Cells(10, "C").Value = Worksheets("数据").Cells(i, "A").Value
- Worksheets(i).Cells(10, "E").Value = Worksheets("数据").Cells(i, "B").Value
- Worksheets(i).Cells(11, "E").Value = Worksheets("数据").Cells(i, "C").Value
- Case Is = "自驾"
- Worksheets(i).Cells(12, "C").Value = Worksheets("数据").Cells(i, "B").Value
- Worksheets(i).Cells(12, "E").Value = Worksheets("数据").Cells(i, "C").Value
- Case Is = "客车"
- Worksheets(i).Cells(14, "C").Value = Worksheets("数据").Cells(i, "A").Value
- Worksheets(i).Cells(14, "E").Value = Worksheets("数据").Cells(i, "B").Value
- Worksheets(i).Cells(15, "E").Value = Worksheets("数据").Cells(i, "C").Value
- End Select
- i = i + 1
- bj = Worksheets("数据").Cells(i, "C").Value
- Loop
- End Sub
复制代码 |
|