Dim path As String ,buf As String, i As Long Dim mysheet As Worksheet, srcbook As Workbook, srcsheet As Worksheet
With Application.FileDialog(msoFileDialogFolderPicker)'フォルダを選択する If .Show = 0 Then MsgBox "キャンセルされました。" Exit Sub End If path = .SelectedItems(1) End With
Set mysheet = ThisWorkbook.Worksheets("comp") buf = Dir(path & "B*.xls")