ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Adding to arrays (https://www.excelbanter.com/excel-programming/411726-adding-arrays.html)

Steve

Adding to arrays
 
Hi

I'm new to arrays and although I think I can work most of it out using the
help file, i'm struggling to find out how I add to an array.

e.g.

a=(1,2,3,4)

How can I add 5 to the end

Your help would be much appreciated.

Many Thanks

Steve

JLGWhiz

Adding to arrays
 
Check out the ReDim method in VBA help.

"Steve" wrote:

Hi

I'm new to arrays and although I think I can work most of it out using the
help file, i'm struggling to find out how I add to an array.

e.g.

a=(1,2,3,4)

How can I add 5 to the end

Your help would be much appreciated.

Many Thanks

Steve


Steve

Adding to arrays
 
Thanks, I can see that this resizes teh array but still not sure how to add
to the array.

Maybe I'm missing something here!!#

Cheers

Steve

"JLGWhiz" wrote:

Check out the ReDim method in VBA help.

"Steve" wrote:

Hi

I'm new to arrays and although I think I can work most of it out using the
help file, i'm struggling to find out how I add to an array.

e.g.

a=(1,2,3,4)

How can I add 5 to the end

Your help would be much appreciated.

Many Thanks

Steve


Alan Beban[_2_]

Adding to arrays
 
Dim a
ReDim a(1 to 4)
a=Array(1,2,3,4)
ReDim Preserve a(1 to 5)
a(5)=5

Alan Beban

Steve wrote:
Thanks, I can see that this resizes teh array but still not sure how to add
to the array.

Maybe I'm missing something here!!#

Cheers

Steve

"JLGWhiz" wrote:


Check out the ReDim method in VBA help.

"Steve" wrote:


Hi

I'm new to arrays and although I think I can work most of it out using the
help file, i'm struggling to find out how I add to an array.

e.g.

a=(1,2,3,4)

How can I add 5 to the end

Your help would be much appreciated.

Many Thanks

Steve



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

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