Hello
I would like to import data from a txt file into my excel workbook. The code posted below works but I need it to paste the data onto a specific hidden sheet "7500 Quant Data" in cell A1 not onto the active sheet with the assigned macro button.
I would like to import data from a txt file into my excel workbook. The code posted below works but I need it to paste the data onto a specific hidden sheet "7500 Quant Data" in cell A1 not onto the active sheet with the assigned macro button.
VBA Code:
Sub ImportTXT()
Dim strFile As String
Dim ws As Worksheet
Set ws = ActiveSheet
strFile = Application.GetOpenFilename("Text Files (*.txt), *.txt")
If strFile = "False" Then Exit Sub
With ws.QueryTables.Add(Connection:="TEXT;" & strFile, Destination:=ws.Range("A1"))
.TextFileParseType = xlDelimited
.TextFileCommaDelimiter = False
.Refresh
End With
End Sub