Ok... off the top of my head and may not compile..
It may not work but should give you an idea what I meant...Code:dim strFN as string dim lngRowOp as long dim lngCol as long dim strLineOfData as string dim varAry as variant 'try not to use variants... but works with split dim sht as worksheet set sht = activesheet strFN = "C:\thefile.txt" close #1 open strfn for input as #1 line input #1, strLineofdata 'this ignores the first line as its usually headers lngrowop=5 do until eof(1) lngrowop=lngrowop+1 line input #1, strlineofdata varAry = split(strlineofdata,"|") ' put the separator character in here - note , * may be used elsewhere, so use a | pipe or ¬ or a very unusal character to separate data '---- also note if your data has speechmarks then you'll need to get creative as the split doesn't recognise speechmarks... for lngcol = 0 to ubound(varary) 'arrays start at 0... cells at 1 sht.cells(lngrowop,lngcol+1)=varary(lngcol) next loop close #1 set sht=nothing 'clear off and free resource
>>> May is probably here - probably wont work




Reply With Quote
