I have the code below, gained from a previous EE question. This basically makes three rows of space in a spreadsheet and then uploads the contents of a CSV file into the spreadsheet. The problem I am having is that the CSV contains some irrelevant data that should be filtered if possible as part of the upload... The CSV file has three comma separated rows e.g.
What I need to do is based on the first column of data (a filename) take only those rows that have a .txt file extension.
Application.ScreenUpdating = False
Application.ScreenUpdating = True
Dim ws As Worksheet, strFile As String
Set ws = ActiveWorkbook.Sheets("Master Results")
strFile = ThisWorkbook.Path & "\targets.csv"
With ws.QueryTables.Add(Connection:="TEXT;" & strFile, Destination:=ws.Range("A1"))
.TextFileParseType = xlDelimited
.TextFileCommaDelimiter = True