Open Workbook- Multiple File [Between 2 File] @pp_92_Basic

PHOTO EMBED

Wed Apr 27 2022 12:53:33 GMT+0000 (Coordinated Universal Time)

Saved by @pharehphatah #vba

Private Sub OpeFile_MutipleFile()

'VARIABLE'

Dim A As Variant
Dim AA As Variant

Dim B As Workbook
Dim C As Worksheet
Dim D As String

On Error Resume Next

'FUNCTION AS'
A = Application.GetOpenFilename(MultiSelect:=True, Password:=ABC)
D = ThisWorkbook.Worksheets("X").Range("A1").Value

'SET VARIABLE'
Set C = ThisWorkbook.Worksheets("Y")

For Each AA In A
	
	'OPEN FILE
	 Set B = Application.Workbooks.Open(AA)

    'CREATE CONDITIONS
    If C.Range("A2") = "" Then
  
		'TYPE PROCESS - 1 HERE'
		C.Range("B1").AutoFilter Field:=1, Criteria1:="TYPE1"
		C.Range("B1").CurrentRegion.Copy

		C.Range("B2").PasteSpecial xlPasteValues
		B.Close SaveChanges:=False
    
    'NEXT CONDTION CONDITIONS'
    Else

		'TYPE PROCESS - 2 HERE'
		C.Range("B1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 10).Select
		Range(Selection, Cells(1, 1)).Select
		Selection.Copy

		C.Range("B1").Cells(Rows.Count, 1).End(xlUp).Offset(1, 0).PasteSpecial xlPasteValues
		B.Close SaveChanges:=False

    End If
    
 On Error GoTo 0
    
Next

End Sub
content_copyCOPY