hello!
when I am inserting data from my textfile, I would like to have it pasted in cell A2 and below. However, instead it is insert in A2, pushing all me columns to the right. how can i stop excel from doing that?
Sub ImportTextFile()
Dim IntPath$, project$, pickf As Object
IntPath = "C:/testfolder/"
Set pickf = Application.FileDialog(msoFileDialogFilePicker)
With pickf
.InitialView = msoFileDialogViewDetails:
.InitialFileName = IntPath:
.Filters.Clear:
.Filters.Add "Pick .txt File", "*.txt", 1:
.ButtonName = "Import file":
.Title = "Search for .txt file to Import"
If .Show = -1 Then
project = .SelectedItems(1)
Else: Exit Sub
End If
End With
Range("A2:AZ500").ClearContents
With ActiveSheet.QueryTables.Add(Connection:="TEXT;" & project, Destination:=Range("A2:N2"))
.RefreshStyle = xlInsertDeleteCells
.Refresh BackgroundQuery:=False
End With
End Sub
thanks,
A2k
Bookmarks