|
本帖最后由 z1979 于 2014-10-17 15:40 编辑
如何才能根据“数据表”中的内容转换成"导岀表"表中的表格格式.
因数据量比较大且项目数量不固定,如果每一行都这样做,工作量比较大。在论坛上找到一些代码凑合,但仍存在问题,
制定好一份表格式,加个循环语句,将数据表中的内容代入表格式中,再复制到另外一个工作簿中,如此循环直到完成。
请各位老师帮帮忙解决
谢谢。
- Sub 导出()
- Dim j
- Application.DisplayAlerts = False
- For j = 12 To [a65536].End(xlUp).Row
- If Cells(j, 1) <> "" Then
- For i = [L4] To [L5] Step 1
- [L2] = i
- [B2] = Cells(j, 1)
- [B3] = Cells(j, 2)
- [B4] = Cells(j, 2)
- [B5] = Cells(j, 2)
- [B6] = Cells(j, 2)
- [B7] = Cells(j, 2)
-
- [B8] = Cells(j, 3)
- [B9] = Cells(j, 3)
-
- [D3] = Cells(j, 4)
- [D4] = Cells(j, 4)
- [D5] = Cells(j, 4)
- [D6] = Cells(j, 4)
- [D7] = Cells(j, 4)
- [D8] = Cells(j, 4)
- [D9] = Cells(j, 4)
-
- [F3] = Cells(j, 5)
- [F4] = Cells(j, 6)
- [F5] = Cells(j, 7)
- [F6] = Cells(j, 8)
- [F7] = Cells(j, 9)
-
-
-
- Range("A2", "H9").Select
- Selection.Copy
- Sheets("导出表").Select
- y = [a65536].End(xlUp).Row + 1
- Range("A" & y).Select
- ActiveSheet.Paste
- Next
- [L4] = 12
- [L2] = 12
- End If
- Next
- 'MsgBox ("导出完成" & i & "个")
- Application.DisplayAlerts = True
- End Sub
复制代码
补充内容 (2014-10-18 17:36):
求助发了几天,没有老师出手。在论坛上找到一些代码凑合。请各位老师看看还有其它的代码可以达到此效果吗,附件在7楼,现在的问题是导出内容不知怎么样设置纸张进行打印。如果老师空闲时间就出手解决。谢谢。 |
|