ALEX has attended:
Excel VBA Intro Intermediate course
Dynamic arrays
I am trying to use the "preserve Redim" command, in order to make use of dynamic arrays. Although I am sure that I am typing everything correctly since I am using one of the worked examples as a point of reference, my sub still does not preserve the existing content in my array and just simply overwrites all the inserted data every time. Is there a way of activating the "preserve" option somehow? Thanks
RE: Dynamic arrays
Hi Alex
Thanks for getting in touch. This one is tricky to diagnose without seeing the file you are working on. But in general Microsoft recommend that you phrase it e.g.
ReDim Preserve myArray(5) As Integer
Are you able to send over a copy of the file? My address is
gary@stl-training.co.uk
If that's not possible, even just the line you are using to declare that array initially, and then the line to redefine the array would be useful to know. In the meantime, here is a link to Microsoft's article on ReDimming:
http://msdn.microsoft.com/en-us/library/w8k3cys2 (v=vs.80).aspx
This article is for VB generally but can apply to Excel.
Kind regards
Gary
Microsoft Office Specialist Trainer
Will be marked as resolved in 5 days
Notice: This is an automated message. Due to inactivity, this forum post will be marked as 'resolved' if there are no further responses in the next 5 days.