ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   RANGE SELECTION (https://www.excelbanter.com/excel-programming/402237-range-selection.html)

FARAZ QURESHI

RANGE SELECTION
 
Suppose I want to select a range of empty cells. The following piece of code
also selects the last non-blank cell as well:

Range(Selection, Selection.End(xlUp)).Select

I want the selection to be of only blanks, in othjer words SHIFT + Down
Arrow once.

Looking forward for your guidance!

Thanx in advance,

Regards

FARAZ!!!

Gary''s Student

RANGE SELECTION
 
Range(Selection, Selection.End(xlUp).Offset(1, 0)).Select
--
Gary''s Student - gsnu200760

Bill Renaud

RANGE SELECTION
 
<<Suppose I want to select a range of empty cells.

Where is the current selection? In a range of cells that are already blank,
or in the middle of a range of data?

<<The following piece of code also selects the last non-blank cell as
well:
Range(Selection, Selection.End(xlUp)).Select

No, it does not. The above code selects from the current selection up to
the end of the data block or end of blank cells, depending on where the
selection is when you start.

<<I want the selection to be of only blanks, in othjer words SHIFT + Down
Arrow once.

Shift+Down Arrow is conflicting with the code you showed above (xlUp)!
Shift+Down Arrow will increase the selection in the DOWN direction, not UP,
as performed by the code above.

--
Regards,
Bill Renaud





All times are GMT +1. The time now is 07:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com