PDA

View Full Version : Solved: How to specify range using contents of cells?



RockMechMark
01-06-2012, 08:20 AM
Here is code I have been trying:

Let beginrow = Cells(3, 19)
Let endrow = Cells(4, 19)
Range("A1").Select
ActiveCell.Offset(0, 0).Range("A" + beginrow + ":J" + endrow).Select

beginrow represents the number of the row in the spreadsheet from which I want to specify a range for copying. endrow is the endrow number for the range to be copied. There is an error on the 4th line. I believe I am using the wrong syntax, but I don't know what it should be.

How can I do this?

mdmackillop
01-06-2012, 08:27 AM
Dim BeginRow As Long, EndRow As Long
BeginRow = Cells(3, 19)
EndRow = Cells(4, 19)
Range("A" & BeginRow & ":J" & EndRow).Select

RockMechMark
01-06-2012, 08:51 AM
Works like a charm.

Thank you so much.