现在我的代码复制&在没有任何特定选择标准的情况下粘贴所有数据。我尝试将某些文件中的特定信息根据其名称复制并粘贴到活动工作表中。我相信我需要的一些功能可以帮助我解决这个问题。任何帮助都会很棒。谢谢。
Private Sub CommandButton1_Click()
Application.DisplayAlerts = False
Application.ScreenUpdating = False
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Set wbb = ThisWorkbook
Set sh = wbb.Worksheets("Sheet1")
With fd
.Title = "Please select Job Folder"
.AllowMultiSelect = True
Err.Clear
FileChosen = fd.Show
If MsgBox("Files selected, continue?", vbYesNo) = vbNo Then Exit Sub
For i = 1 To fd.SelectedItems.Count
file = fd.SelectedItems(i)
Workbooks.Open Filename:=file, ReadOnly:=True
If file = "" Then Exit Sub
filesheet = "Sheet1"
ActiveWorkbook.Sheets(filesheet).Range("A1:A3").Copy
LastRow = sh.Cells(sh.Rows.Count, "A").End(xlUp).Row
sh.Cells(sh.Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
ActiveWorkbook.Close savechanges:=False
Next i
End With
Application.DisplayAlerts = True
Application.ScreenUpdating = True
End Sub