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

Thanks Jacob, but I never know how many rows I'll have...........but I do
believe KC hit it on the head......
"Jacob Skaria" wrote in message
...
With wbOriginal.Sheets("Data")
'Loop from 3rd row to 100 row/Col A(1) to G(7)
For lngRow = 3 To 100
For lngCol = 1 To 7
wbArchive.Sheets("Sheet1").Cells(lngRow - 2, lngCol) = .Cells(lngRow,
lngCol).Value
Next
Next
End With

If this post helps click Yes
---------------
Jacob Skaria


"DonW" wrote:

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