这应该让你开始: 在自己的Excel工作簿使用VBA,有它提示用户他们的数据文件的文件名, 然后只复制固定的范围到目标工作簿(可能是相同的工作簿作为您的宏启用一个,或第三个工作簿)。 这里是如何工作的快速VBA例如:
' Get customer workbook...
Dim customerBook As Workbook
Dim filter As String
Dim caption As String
Dim customerFilename As String
Dim customerWorkbook As Workbook
Dim targetWorkbook As Workbook
' make weak assumption that active workbook is the target
Set targetWorkbook = Application.ActiveWorkbook
' get the customer workbook
filter = "Text files (*.xlsx),*.xlsx"
caption = "Please Select an input file "
customerFilename = Application.GetOpenFilename(filter, , caption)
Set customerWorkbook = Application.Workbooks.Open(customerFilename)
' assume range is A1 - C10 in sheet1
' copy data from customer to target workbook
Dim targetSheet As Worksheet
Set targetSheet = targetWorkbook.Worksheets(1)
Dim sourceSheet As Worksheet
Set sourceSheet = customerWorkbook.Worksheets(1)
targetSheet.Range("A1", "C10").Value = sourceSheet.Range("A1", "C10").Value
' Close customer workbook
customerWorkbook.Close
来源
2011-10-24 15:30:59
jdh
另一个......链接点击进入制药业骗局。请删除并用Wayback机器副本进行更换。同时,读者请注意点击上面的链接(vba4all [dot] com ...)。 –