Can someone please help me with VBA code.
I am trying to copy 2 ranges of cells between books (both books must be created in advance, since I do not want the code to create a new book "on the fly").
First, I need to copy these ranges - From "Sheet 3" booka.xls Range: cell H5 to the last row in column H with data copy this to "Sheet 1" bookb.xls, starting with Cell B2 so that as much cells dropped in column B
Secondly, I need to copy these ranges - From "Sheet 3" booka.xls Range: cell K5 to the last row in column K with data copy this to "Sheet 1" bookb.xls, starting with Cell D2 so that as much cells dropped in column D
Here is what I still have:
Sub CopyDataBetweenBooks() Dim iRow As Long Dim wksFr As Worksheet Dim wksTo As Worksheet wksFr = "C:\booka.xls" wksTo = "C:\bookb.xls" Set wksFrom = Workbooks(wksFr).Worksheets("Sheet 3") Set wksTo = Workbooks(wksTo).Worksheets("Sheet 1") With wksFrom For iRow = 1 To 100 .Range(.Cells(iRow, 8), .Cells(iRow, 9)).Copy wksTo.Cells(iRow, 8) Next iRow End With End Sub
source share