I\'m running a Macro on Excel to import multiple .txt files and with a filter set to the filename, so it acts like a wildcard. Every file has the same layout, it\'s Semicolo
Adding a check if Range("A1") is empty so it starts at A1 if A1 is empty...
Tested and working:
Sub Importar_PORT(iFullFilePath As String, iFileNameWithoutExtension)
Dim lngStartRow As Long
With ActiveSheet
If .Range("A1") = "" Then
lngStartRow = 1
Else
lngStartRow = .Range("A" & .Rows.Count).End(xlUp).row + 1
End If
End With
With ActiveSheet.QueryTables.Add(Connection:= _
"TEXT;" & iFullFilePath, _
Destination:=Range("$A$" & lngStartRow))