Something Like this;-
http://somethinglikeant.110mb.com/ex...Crime_Data.xls
Code
---------------------------------------------------------------------
Sub ImportCrimeStats()
'switch calculation off to speed up macro
Application.Calculation = xlManual
'Pick up file path information
qfolder = [B5]: qfile = [B8]
'set counter
a , b, c, k = 0
'find where to write in the data sheets
a = Sheets("Newark").[A1].End(xlDown).Row + 1
b = Sheets("Jackson").[A1].End(xlDown).Row + 1
c = Sheets("Floence").[A1].End(xlDown).Row + 1
'Open Text File
Open qpath & qfile For Input Access Read As #1
Do Until EOF(1)
Line Input #1, qdata
'variables
If UCase(Left(qdata, 4)) <> "CITY" Then
q1 = Trim(Mid(qdata, x1, y1))
q2 = Trim(Mid(qdata, x2, y2))
'Go to city sheet and write data
Sheets(q1).Select
If q1 = "Newark" Then k = a
If q1 = "Jackson" Then k = b
If q1 = "Florence" Then k = c
Cells(k, 1) = Date
Cells(k, 2) = q1
Cells(k, 3) = q2
End If
Loop
Close #1
Sheets("Macro").Select
'reset calculation
Application.Calculation = xlCalculationAutomatic
End Sub
-------------------------------------------------------------------------
We need to know what the structure of the text file is to replace
x1,x2,y1,y2 with numbers for the MID function to work.
I have also made an assumption about the content of the "City" sheets.
You will need to input the File Path and File Name of your weekly text
file into the Macro tab.
But you should be able to tweak this to your needs. Let me know if you
need anything further.
http://www.excel-ant.co.uk