Assigning a cell address to a variable
James,
This would set the variable LastDay to the address of the last used cell in
column A and then create a named range from A1 to that cell
LastDay = "A" & Cells(Cells.Rows.Count, "A").End(xlUp).Row
Set MyRange = Range("A1:" & LastDay)
--
Mike
When competing hypotheses are otherwise equal, adopt the hypothesis that
introduces the fewest assumptions while still sufficiently answering the
question.
"James" wrote:
I'm sure this is a simple question, but I've been searching and cannot seem
to find the answer to it. I have a couple of loops that run that put data
onto a spreadsheet, I want to before the loop runs assign a variable the
address of the first cell and at the end assign a variable the address of the
last cell. I am trying to use
Set LastDay = Range(Cells(3, CalCount))
but this gives me an error. Any ideas or help I would love.
Thanks
|