Thread: Macro Error
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.misc
Roger Dodger Roger Dodger is offline
external usenet poster
 
Posts: 10
Default Macro Error

Its like your talking another language.

I'll give it a try when I get back to work on Monday.

Thanks for your help

Roger

"GS" wrote in message ...
Don Guillett pretended :
You do not need or want the scrolls and selections

Sub Load_Reports()
Workbooks.OpenText FileName:="U:\BruckWRK\DYE905.LST",
Origin:=xlWindows, StartRow
:=1, DataType:=xlFixedWidth, FieldInfo:=Array(Array(0, 1),
Array(5, 9), Array( _
10, 1), Array(39, 9), Array(41, 1), Array(54, 1), Array(67,
1), Array(80, 1), Array(92, 1), _
Array(104, 1), Array(116, 9))
'DELETING FROM THE TOP UP MAY NOT??? GIVE THE DESIRED RESULTS.
Rows("1:6").Delete
Rows("51:56").Delete
Rows("101:106").Delete
Rows("151:156").Delete
Rows("201:206").Delete
Rows("251:256").Delete
Rows("301:306").Delete
Rows("351:356").Delete
Rows("401:406").Delete
'YOU MAY WANT SOMETHING LIKE this instead. Check CAREFULLY
'for i = 401 to 1 step -50
'rows(i).resize(5).delete
'next i

Possible alternative...

Const sRowsToDelete As String = _
"401:406,351:356,301:306,251:256,201:206,151:156,1 01:106,51:56,1:6"
'use if Resize is NOT constant

Const sRowsToDelete As String = "401,351,301,251,201,151,101,51,1"
'use if Resize is constant

Dim vRowsToDelete
vRowsToDelete = Split(sRowsToDelete, ",")
For i = LBound(vRowsToDelete) To UBound(vRowsToDelete)
Rows(vRowsToDelete(i)).Delete
'Rows(vRowsToDelete(i)).Resize(5).Delete
Next 'i

--
Garry

Free usenet access at http://www.eternal-september.org
ClassicVB Users Regroup! comp.lang.basic.visual.misc