ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Set array element to empty (https://www.excelbanter.com/excel-programming/324407-set-array-element-empty.html)

Raul

Set array element to empty
 
I have an array that is type single and I would like to delete values that
meet a certain criteria. If the array was variant I could set the a
particular array element to "". How do I do something similar for an array
that is not variant?

Thanks,
Raul

Jake Marx[_3_]

Set array element to empty
 
Hi Raul,

A Single does not have an "empty" value. Its initial value is 0. So the
best you can do is set its value to 0 when you want to "clear" it. So, in
your case, you may want to either 1) use a Variant array and set the values
to be cleared to vbNullString (or ""); or 2) use a Single array as the
source, and create a new Single array, copying only the values you need from
the source array.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]


Raul

Set array element to empty
 
Thanks a bunch for the quick and informative respsonse! In this case I'll go
with option 1.

Thanks again,
Raul

"Jake Marx" wrote:

Hi Raul,

A Single does not have an "empty" value. Its initial value is 0. So the
best you can do is set its value to 0 when you want to "clear" it. So, in
your case, you may want to either 1) use a Variant array and set the values
to be cleared to vbNullString (or ""); or 2) use a Single array as the
source, and create a new Single array, copying only the values you need from
the source array.

--
Regards,

Jake Marx
MS MVP - Excel
www.longhead.com

[please keep replies in the newsgroup - email address unmonitored]




All times are GMT +1. The time now is 01:09 PM.

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