1) The header remains in the data copied even thought "StartRow := 2"
2) I am able to see all file types even though '"fileFilterPatttern = "Microsoft Excel Workbooks (*.xls*),*.xls*"'
VBA below
Sub ImportText()
'
' ImportText Macro
Dim fileToOpen As Variant
Dim fileFilterPattern As String
Dim wsMaster As Worksheet
Dim wbTextImport As Workbook
Dim lr As Long
Application.ScreenUpdating = False
fileFilterPatttern = "Microsoft Excel Workbooks (*.xls*),*.xls*"
fileToOpen = Application.GetOpenFilename(fileFilterPattern)
If fileToOpen = False Then
' input Cancelled
MsgBox "No file Selected."
Else
Workbooks.OpenText _
Filename:=fileToOpen, _
StartRow:=2, _
DataType:=xlDelimited, _
Tab:=True
Set wbTextImport = ActiveWorkbook
Set wsMaster = ThisWorkbook.Worksheets("Asset Upload Data 2022")
lr = wsMaster.Cells(Rows.Count, 1).End(xlUp).Offset(1).Row
wbTextImport.Worksheets(1).Range("A2").CurrentRegion.Copy wsMaster.Range("C" & lr)
wbTextImport.Close False
End If
Application.ScreenUpdating = True
'
End Sub
2) I am able to see all file types even though '"fileFilterPatttern = "Microsoft Excel Workbooks (*.xls*),*.xls*"'
VBA below
Sub ImportText()
'
' ImportText Macro
Dim fileToOpen As Variant
Dim fileFilterPattern As String
Dim wsMaster As Worksheet
Dim wbTextImport As Workbook
Dim lr As Long
Application.ScreenUpdating = False
fileFilterPatttern = "Microsoft Excel Workbooks (*.xls*),*.xls*"
fileToOpen = Application.GetOpenFilename(fileFilterPattern)
If fileToOpen = False Then
' input Cancelled
MsgBox "No file Selected."
Else
Workbooks.OpenText _
Filename:=fileToOpen, _
StartRow:=2, _
DataType:=xlDelimited, _
Tab:=True
Set wbTextImport = ActiveWorkbook
Set wsMaster = ThisWorkbook.Worksheets("Asset Upload Data 2022")
lr = wsMaster.Cells(Rows.Count, 1).End(xlUp).Offset(1).Row
wbTextImport.Worksheets(1).Range("A2").CurrentRegion.Copy wsMaster.Range("C" & lr)
wbTextImport.Close False
End If
Application.ScreenUpdating = True
'
End Sub