ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Range object without blank cells (https://www.excelbanter.com/excel-discussion-misc-queries/67016-range-object-without-blank-cells.html)

RMJames

Range object without blank cells
 
Hi

How do i call the following code, but not get back any empty cells

Set tempRange = Worksheets("Step Chart").Range("ColumnMapping")

As it returns all the cells, even if they are blank/empty...

I can return just the empty cells by using
..SpecialCells(xlCellTypeBlanks)
What is the reverse of this?

As in the end i want an array without any empty values, if there is any
in the named range.


Bernie Deitrick

Range object without blank cells
 
RMJ,

If you have only constansts, use

Worksheets("Step Chart").Range("ColumnMapping").SpecialCells(xlCell TypeConstants)

If you have only formulas, use

Worksheets("Step Chart").Range("ColumnMapping").SpecialCells (xlCellTypeFormulas)


If you have mixed formulas and constants, you need

With Worksheets("Step Chart").Range("ColumnMapping")
Set tempRange = Union(.SpecialCells(xlCellTypeConstants), .SpecialCells(xlCellTypeFormulas))
End With


HTH,
Bernie
MS Excel MVP


"RMJames" wrote in message
oups.com...
Hi

How do i call the following code, but not get back any empty cells

Set tempRange = Worksheets("Step Chart").Range("ColumnMapping")

As it returns all the cells, even if they are blank/empty...

I can return just the empty cells by using
.SpecialCells(xlCellTypeBlanks)
What is the reverse of this?

As in the end i want an array without any empty values, if there is any
in the named range.





All times are GMT +1. The time now is 08:52 PM.

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