Determine range with VBA
Dim rng as Range
with Workbooks("OtherName.xls").Worksheets("Sheet1")
set rng = .Range(.Cells(1,1),.Cells(rows.count,1).End(xlup))
set rng = rng.Resize(,10) ' to get 10 columns
End with
or
set rng = .Range("A1").CurrentRegion
or
' less reliable
set rng = .UsedRange
--
Regards,
Tom Ogilvy
Bryon wrote in message
...
I am looking to copy Data from another Workbook (which is
never the same size). what code do I need to determine
the last row that data is entered on so I can set up the
Range?
|