Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default initialize an array to 0


this should be an easy question for the excel gurus out there...i have
an array with size 100 and i want to initialize every value in the
array to 0...is there an easy way to do this without running a for
loop?


--
kdp145
------------------------------------------------------------------------
kdp145's Profile: http://www.excelforum.com/member.php...o&userid=29594
View this thread: http://www.excelforum.com/showthread...hreadid=521719

  #2   Report Post  
Posted to microsoft.public.excel.programming
N10 N10 is offline
external usenet poster
 
Posts: 141
Default initialize an array to 0

try this


Redim a(100) ' initial declaration of the variable

your code


Rem Clear A array

redim a(100)

more code

Best N10


"kdp145" wrote in
message ...

this should be an easy question for the excel gurus out there...i have
an array with size 100 and i want to initialize every value in the
array to 0...is there an easy way to do this without running a for
loop?


--
kdp145
------------------------------------------------------------------------
kdp145's Profile:
http://www.excelforum.com/member.php...o&userid=29594
View this thread: http://www.excelforum.com/showthread...hreadid=521719



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default initialize an array to 0

Use the Erase function. If the array is dynamically resized with
ReDim, you'll have to ReDim it.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com




"kdp145"
wrote in message
...

this should be an easy question for the excel gurus out
there...i have
an array with size 100 and i want to initialize every value in
the
array to 0...is there an easy way to do this without running a
for
loop?


--
kdp145
------------------------------------------------------------------------
kdp145's Profile:
http://www.excelforum.com/member.php...o&userid=29594
View this thread:
http://www.excelforum.com/showthread...hreadid=521719



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 200
Default initialize an array to 0

kdp145 wrote:
this should be an easy question for the excel gurus out there...i have
an array with size 100 and i want to initialize every value in the
array to 0...is there an easy way to do this without running a for
loop?



I don't know what you mean by "i have an array", but any of the
following will result in an array initialized with zeroes:

Dim arr(100) As Integer
Dim arr(100) As Long
Dim arr(100) As Double

Alan Beban
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Initialize an array Kleev Excel Programming 6 December 1st 05 06:09 PM
initialize userform, using a sub natanz[_2_] Excel Programming 11 November 22nd 05 05:30 AM
Initialize macro Tom Jung Excel Programming 1 October 31st 05 04:04 AM
Initialize variable hotherps[_128_] Excel Programming 2 August 26th 04 02:38 PM
Initialize data in new row? Ken[_12_] Excel Programming 1 August 9th 03 05:13 PM


All times are GMT +1. The time now is 06:57 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"