ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Range to array excluding null values (https://www.excelbanter.com/excel-programming/410593-range-array-excluding-null-values.html)

avi

Range to array excluding null values
 
Hello,

Is there a way to create an array from a range with the formula
(varArray = RangeAddress) but excluding empty cells in the range (ot
any value)

It can be done by looping, but I am looking for the quick formula way

Thanks
avi

Bernie Deitrick

Range to array excluding null values
 
avi,

No need to use an array. You can directly address the cells of the range using:

Dim mcC As Range
For Each myC In Range("D2:D16").SpecialCells(xlCellTypeConstants, 23)
'whatever you want here
Next myC


--
HTH,
Bernie
MS Excel MVP


"avi" wrote in message
...
Hello,

Is there a way to create an array from a range with the formula
(varArray = RangeAddress) but excluding empty cells in the range (ot
any value)

It can be done by looping, but I am looking for the quick formula way

Thanks
avi




avi

Range to array excluding null values
 
Thanks but I really need it as an array for the rest of my application
Avi

Bernie Deitrick

Range to array excluding null values
 
Avi,

Then you will need to loop through the cells as shown and assign the values
to the array, after using redim on the array to set the size.

Bernie

"avi" wrote in message
...
Thanks but I really need it as an array for the rest of my application
Avi





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

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