ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Processing input data (https://www.excelbanter.com/excel-programming/370216-processing-input-data.html)

dan

Processing input data
 
I am importing a text file on a line by line basis and want to modify the
file as it is being imported. Presently it is importing in delimited format
style and want to switch over to a fixed width style and also process the
data as it is imported.

Here is what I have:

'Set The Counter to 1
Counter = 1
'Loop Until the End Of File Is Reached
Do While Seek(FileNum) <= LOF(FileNum)
'Store One Line Of Text From File To Variable
Line Input #FileNum, ResultStr
'Store Variable Data Into Active Cell
If Left(ResultStr, 1) = "=" Then
ActiveCell.Value = "'" & ResultStr
Else
ActiveCell.Value = ResultStr --- when counter =7 want to
process data
End If
'Increment the Counter By 1
Counter = Counter + 1
'Start Again At Top Of 'Do While' Statement
Loop
'Close The Open Text File
Close
'Remove Message From Status Bar
Application.StatusBar = False
End Sub

Want to have the data imported in a Fixed width format and also then run
additional macros based on the value of the data.


Thanks


All times are GMT +1. The time now is 11:58 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com