Quantcast
Viewing all articles
Browse latest Browse all 11829

Get address of last cell in a range.

From what I've seen, a cell's "address" is a range object even if it's one cell, so I declared:

destinationCell As Range
countOfColumns as Long
countOfRows as Long

and given a range, rangelastArea (from a selection) and finding the number of rows and range for the above counts I use:

Set destinationCell = rangeLastArea.Cells(countOfRows, countOfColumns) 'to get the address/range of the last cell.

When I use msgBox destinationCell 'I get a message box with the contents of the last cell.

If I use Set destinationCell = rangeLastArea.Cells(countOfRows, countOfColumns).Address'I get "runtime error 424 Object required."

How do I get the last cell's "address" (range object)?

(Note, I am NOT trying to find the last cell, row or column with data, I want the actual last cell of the range.)


Viewing all articles
Browse latest Browse all 11829

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>