To select cells in the lower right corner of the range to understand how to handle combined cells
Dim RangeObj as Range
Set Range= ActiveSheet.Range ("A4:A7")
RangeObj.Cells.SpecialCells (xlCellTypeLastCell).Select
When I ran , I chose the one in the sheet, the edited cell at the bottom right of the sheet cell (G11 in the example below).
It seems to be working on the entire sheet with the cells specified in Range, but what specifications do you have?
The lower right cell in the P.S. range was selected in RangeObj.Cells(RangeObj.Count).Select
.
Program
Dim RangeObj as Range
Set Range= ActiveSheet.Range ("A4:A7")
At the time of running , the variable RangeObj was declared of type Range and was not initialized (no value).
The variable Range is initialized and has the value ActiveSheet.Range("A4:A7").
In that state
RangeObj.Cells.SpecialCells (xlCellTypeLastCell).Select
The uninitialized variable RangeObj was interpreted as a state in which no cell was selected (implicitly intended for the entire sheet).
© 2024 OneMinuteCode. All rights reserved.