How to find location of last cell from defined Range? Cell does not have to contain any data but must be most right and most down located cell from certain Range.
Set rngOrigin = wksOrigin.Cells(IntFirstRow, IntFirstColumn).CurrentRegion
I wish to receive
Cells(i,j)
The answers given by others mostly work, but not if the region is a union of non-contiguous cells. Here is a version that works consistently for single and multi-area regions, contiguous and non-contiguous.
Perhaps this is what you want:
In your case, since you want to find the cell to the most right and down in your
wksOrigin
(defined as Worksheet), you could use theSpecialCells(xlCellTypeLastCell)
to get the last cell Row and Column.If you want to debug your result, you can add:
I handled it in below code but your remarks were helpful. Thank you.
try the following
or you could use the
CurrentRegion
and count the rows and columns and useOffset
maybe you're after this: