Hi there i am new to forum and need a little help, I have been trying to copy data from one workbook to master workbook which contain tables where copied data should go.I have a post in another excel forum here, http://www.excelforum.com/excel-programming-vba-macros/977613-copy-data-from-changing-range-in-on-workbook-to-another.html
您好,我是新来的论坛,需要一些帮助,我一直在尝试将数据从一个工作簿复制到主工作簿,其中包含复制数据应该去的表。我在这里有另一个excel论坛的帖子,http:// www .excelforum.com / EXCEL编程-VBA的宏/ 977613-复制数据从变化的工作范围变换中,上工作簿到another.html
but the code doesnt work properly and no matter what i try i cant figure it out, but the other day i came across a post here that the code given in the answer is just about perfect the post is located here VBA copying data from one workbook to another
但代码无法正常工作,无论我尝试什么我都无法弄清楚,但有一天我在这里发现一个帖子,答案中给出的代码是完美的帖子位于这里VBA从一个工作簿复制数据到另一个
this work just about perfect only 2 small problems with it that i cant get to work
这项工作只是完美地解决了我无法解决的两个小问题
- i cant get the data that is copied over to the master to go into row 2 its like the code thinks there is data there because its a table?
- i cant get master to save and close
我无法获取复制到主服务器的数据进入第2行,就像代码认为那里有数据一样,因为它有一个表?
我无法让主人保存并关闭
see code below I hope i put code in properly and not broke any forum rules
看下面的代码我希望我正确地放入代码,而不是破坏任何论坛规则
Thanks for any help
谢谢你的帮助
Sub SendToMaster()
'this macro goes IN the sender workbook
Dim wsSEND As Worksheet
Dim wbMASTER As Workbook
Dim NextRow As Long, LastRow As Long
Set wsSEND = ThisWorkbook.Sheets("january")
LastRow = wsSEND.Range("A" & Rows.Count).End(xlUp).Row
Set wbMASTER = Workbooks.Open("C:\Documents and Settings\Ian\My Documents\excel\Disk_Inventory_V3_master.xlsm")
With wbMASTER.Sheets("january")
NextRow = .Range("A" & .Rows.Count).End(xlUp).Row + 1
wsSEND.Range("A2:E" & LastRow).Copy
.Range("A" & NextRow).PasteSpecial xlPasteValues
.Range("A" & NextRow).PasteSpecial xlPasteFormats
End With
wsSEND.Range("A2:E200").ClearContents
ThisWorkbook.Save
ThisWorkbook.Close
wbMASTER.Close True
'save and close the master
End Sub
1 个解决方案
#1
0
Yes it is a named table created by format and you can see in ribbon. The name of the table is the same as the page name january
是的,它是按格式创建的命名表,您可以在功能区中看到。表的名称与页面名称1月相同
#1
0
Yes it is a named table created by format and you can see in ribbon. The name of the table is the same as the page name january
是的,它是按格式创建的命名表,您可以在功能区中看到。表的名称与页面名称1月相同