Hi Guys,
I have an problem wherein i want to filter querytable object which is imported from csv file on certain condition.
Firstly i am not using recordset,code i am using as follows
With Sheets(sheetName)
.Visible = True
'check for range, and delete if it exists
With .QueryTables.Add(Connection:= _
"TEXT;" & strPath, Destination:=.Range("A1"))
.Name = sheetName & "Forecast"
.FieldNames = True
.RowNumbers = False
.FillAdjacentFormulas = False
.PreserveFormatting = True
.RefreshOnFileOpen = False
.RefreshStyle = xlOverwriteCells
.SavePassword = False
.SaveData = True
.AdjustColumnWidth = True
.RefreshPeriod = 0
.TextFilePromptOnRefresh = False
.TextFilePlatform = 850
.TextFileStartRow = 1
.TextFileParseType = xlDelimited
.TextFileTextQualifier = xlTextQualifierDoubleQuote
.TextFileCommaDelimiter = True
.TextFileColumnDataTypes = Array(1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, _
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1)
.TextFileTrailingMinusNumbers = True
On Error Resume Next
'gives error when the file is empty
.Refresh BackgroundQuery:=False
On Error GoTo 0
End With
End With
To explain further says csv has 900 records i want only 300 records to be imported and these 300 records can be placed anywhere in the CSV file.
Each Record has a date field which decides which record to be picked up
Any help would be highly appreciated,thanx
Bookmarks