View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Claus Busch Claus Busch is offline
external usenet poster
 
Posts: 3,872
Default Paste in column B using Last row of either column B, C or D.

Hi Howard,

Am Mon, 17 Nov 2014 01:36:39 -0800 (PST) schrieb L. Howard:

So if the FERow works for the sheet8 range, I tried to use a BERow for the range on sheet7.


FERow (First Empty Row) is the last row + 1.
For the range to copy you don't need to add 1.
And for the next loop you have to reset n to 0:

Sub TestEXP()
Dim varLen(2) As Variant
Dim i As Long, n As Long
Dim FERow As Long, BERow As Long

With Sheets("Sheet7")
For i = 2 To 4
varLen(n) = .Cells(Rows.Count, i).End(xlUp).Row
n = n + 1
Next
BERow = WorksheetFunction.Max(varLen)
MsgBox BERow
End With

With Sheets("Sheet8")
n = 0
For i = 2 To 4
varLen(n) = .Cells(Rows.Count, i).End(xlUp).Row
n = n + 1
Next
FERow = WorksheetFunction.Max(varLen) + 1

Sheets("Sheet7").Range("B2:D" & BERow).Copy .Range("B" & FERow)
End With

End Sub


Regards
Claus B.
--
Vista Ultimate / Windows7
Office 2007 Ultimate / 2010 Professional