|
因为小白,第一次遇见这样的定位写法,看不懂商贸意思,请教哪位老师有空的话给我解释一下。多谢了!
我修改了一下行数,怎么也都运行不成功 ,总是每次多一行。主要是给我解释一下这一部分是这么定位的即可,多谢了!
Sub 模板()
Application.ScreenUpdating = False
Dim x, k, m, f As Integer
Dim fs1$, fs2$
k = Sheets("数据").Cells(Rows.Count, 1).End(xlUp).Row
If Int((k - 1) / 2) = (k - 1) / 2 Then
f = k / 2 - 1
Else
f = Int((k - 1) / 2)
End If
For m = 1 To f
Sheets("模板").Rows("1:10").Copy Sheets("模板").Cells(Rows.Count, 1).End(xlUp).Offset(2)
Next m
For x = 2 To k Step 2
Sheets("模板").Cells(x * 4.5 - 4, 2) = Sheets("数据").Cells(x, 2).Value
Sheets("模板").Cells(x * 4.5 - 3, 2) = Sheets("数据").Cells(x, 3).Value
Sheets("模板").Cells(x * 4.5 - 2, 2) = Sheets("数据").Cells(x, 4).Value
Sheets("模板").Cells(x * 4.5 - 1, 2) = Sheets("数据").Cells(x, 5).Value
Sheets("模板").Cells(x * 4.5, 2) = Sheets("数据").Cells(x, 6).Value
Sheets("模板").Cells(x * 4.5 - 4, 7) = Sheets("数据").Cells(x + 1, 2).Value
Sheets("模板").Cells(x * 4.5 - 3, 7) = Sheets("数据").Cells(x + 1, 3).Value
Sheets("模板").Cells(x * 4.5 - 2, 7) = Sheets("数据").Cells(x + 1, 4).Value
Sheets("模板").Cells(x * 4.5 - 1, 7) = Sheets("数据").Cells(x + 1, 5).Value
Sheets("模板").Cells(x * 4.5, 7) = Sheets("数据").Cells(x + 1, 6).Value
Next x
Application.ScreenUpdating = True
End Sub
|
-
-
|