我有一个代码从工作簿A中的特定工作表中选择所有数据(在代码中名称为'fn')并将其复制到工作簿B中的特定工作表中。我想要做的是仅贴上值,即贴,同时保持/转换(到)过去片表的格式从复印纸上复制的值,这里是我的代码 -使用vba粘贴值
Set copySheet = copyBook.Sheets(fn) 'Points to the sheet in the raw data file
Set pasteBook = ThisWorkbook 'Sets the file where we are supposed to paste to as the template file
Application.DisplayAlerts = False
Set pasteSheet = pasteBook.Sheets("Transaction") 'Points to the Transaction sheet on the template
lastRow = copySheet.Cells(Rows.Count, 1).End(xlUp).row 'Computes the last row on the raw data file
'Copies raw data to tab/sheet in template
copySheet.Activate
Application.ScreenUpdating = False
For column = 1 To 27
For row = 2 To lastRow
cp = copySheet.Cells(row, column)
pasteSheet.Cells(row + 211, column).Value = cp
Next
Next
Application.ScreenUpdating = True
copyBook.Close 'Closes the raw data file
End If
注 - 我真的喜欢这我只是对上面的代码做了一些小改动,而不是完全制作其他代码。谢谢!
你为什么循环? Wy不会复制并一次性完成粘贴操作? – 2014-10-27 16:02:06
你能告诉我怎么做:)(如在代码本身) – 2014-10-27 16:18:59
我可以但为什么你不记录一个宏,并尝试为自己:) – 2014-10-27 16:33:27