我有一個宏(在StackOverflow上找到),旨在允許用戶從他們的桌面選擇一個工作簿,並將該表的A列中的所有信息複製到列A在主要的工作簿中。但是,宏沒有粘貼的數據。它只是在想要粘貼的區域留下虛線。任何幫助都非常感謝。Excel VBA代碼不粘貼數據
Sub PopulateUploaderFunds()
Dim uploadfile As Variant
Dim uploader As Workbook
Dim CurrentBook As Workbook
Set CurrentBook = ActiveWorkbook
MsgBox ("Please select uploader file to be reviewed")
uploadfile = Application.GetOpenFilename()
If uploadfile = "False" Then
Exit Sub
End If
Workbooks.Open uploadfile
Set uploader = ActiveWorkbook
With uploader
Application.CutCopyMode = False
Range("A:A").Copy
End With
CurrentBook.Activate
Sheets("Load Barcodes").Range("A1").PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
End Sub
你粘貼值,所以只設置範圍給對方。另外,不要複製整個列。 – findwindow
我不太明白你想說什麼嗎?我應該這樣做:'範圍(「A1:A100」)。value =表格(「加載條形碼」)範圍(「A1:100」)。值' – Tokioi