0
파일 대화 상자를 사용하여 다양한 Excel 파일의 데이터를 복사하여 단일 워크 시트에 붙여 넣습니다. 그러나 두 번째 파일은 첫 번째 파일의 데이터를 덮어 씁니다. 첫 번째 데이터는 대상 통합 문서에서 A2 : E2710 범위에 붙여 넣었습니다. 두 번째 데이터 집합이 A2 : A118이면 대상 통합 문서에서 A2 : A118을 덮어 씁니다. 이전에 붙여 넣은 데이터를 붙여 넣기하고 덮어 쓰지 않으려면 어떻게해야합니까? Selection.Insert Shift : = xlDown 시도했지만 데이터를 붙여 넣지 않습니다. 도와주세요.이전 데이터를 덮어 쓰지 않고 복사 한 셀 붙여 넣기
Sub FASB_Select()
'Create a FileDialog object as a File Picker dialog box.
Set fd = Application.FileDialog(msoFileDialogFilePicker)
Set ExcelSheet = CreateObject("Excel.Sheet")
'Declare a variable to contain the path
'of each selected item. Even though the path is a String,
'the variable must be a Variant because For Each...Next
'routines only work with Variants and Objects.
Dim vrtSelectedItem As Variant
'Use a With...End With block to reference the FileDialog object.
With fd
'Use the Show method to display the File Picker dialog box and return the user's action.
'The user pressed the action button.
If .Show = -1 Then
Sheets("Data").Select
'Step through each string in the FileDialogSelectedItems collection.
For Each vrtSelectedItem In .SelectedItems
'vrtSelectedItem is a String that contains the path of each selected item.
'You can use any file I/O functions that you want to work with this path.
'This example simply displays the path in a message box.
ThisWorkbook.FollowHyperlink (vrtSelectedItem)
'Clear CutCopyMode
Application.CutCopyMode = False
'Wait some time
Application.Wait Now + TimeValue("00:00:01") ' wait 3 seconds
DoEvents
'IN Excel :
'SELECT ALL
Range("A2").Select
Range(Selection, Selection.End(xlToRight)).Select
Range(Selection, Selection.End(xlDown)).Select
Selection.Copy
'EXIT (Close & Exit)
Application.Wait Now + TimeValue("00:00:01") ' wait 3 seconds
ActiveWorkbook.Close SaveChanges:=False
'Wait some time
Application.Wait Now + TimeValue("00:00:01") ' wait 3 seconds
Range("A2").Select
'Paste
ActiveSheet.Paste
Next vrtSelectedItem 'Loop for each file selected in the file dialog box
'Exit if the user pressed Cancel
Else
Exit Sub
End If
End With
'Set the object variable to Nothing
Set fd = Nothing
End Sub
* 각 섹션을 붙여 넣어야합니까? –