View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
DonW[_2_] DonW[_2_] is offline
external usenet poster
 
Posts: 10
Default Help with Loop Please

Thank you KC...........I think this will do the trick
"KC" wrote in message
...
Is there a typo that the line before End With should have B2 instead of B1
please?
if affirmative, may be

With wbOriginal.Sheets("Data")
n=.range(.range("a3"),.range("a3").end(xldown)).ro ws.count
wbArchive.Sheets("Sheet1").Range("A1").resize(n,7) =
.Range("A3").resize(n,7)
End With


"DonW" wrote in message
...
Does anyone know how I can set up a loop so (let's say anywhere between
10
to 150 or more rows) "all" of the data could be accounted for?

This is what I have:

Dim wbArchive As Workbook
Dim wbOriginal As Workbook

Set wbArchive = ActiveWorkbook
wbArchive.SaveAs Filename:="E:\Archived Logs\Data.xls"

Windows("original_file.xls").Activate
Set wbOriginal = ActiveWorkbook

With wbOriginal.Sheets("Data")
wbArchive.Sheets("Sheet1").Range("A1") = .Range("A3").Value
wbArchive.Sheets("Sheet1").Range("B1") = .Range("B3").Value
wbArchive.Sheets("Sheet1").Range("A2") = .Range("A4").Value
wbArchive.Sheets("Sheet1").Range("B1") = .Range("B4").Value
End With

the wbOriginal header row starts in row 3.
I'd like to be able to loop through the rest of the wboriginal so all (up
to
column G) wide, and cover as many rows down


Thanks, Don