98.7% Of all customers recommend us, we're so confident about our results we publish all reviews and stats
View Live Stats View ReviewsForum home » Delegate support and help forum » Microsoft Excel VBA Training and help » Dynamic arrays
Dynamic arrays
Resolved · Urgent Priority · Version 2007
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.
Wed 19 Sep 2012: Automatically marked as resolved.
Training information:
Welcome. Please choose your application (eg. Excel) and then post your question. Our Microsoft Qualified trainers will then respond within 24 hours (working days). Frequently Asked Questions
Any suggestions, questions or comments? Please post in the Improve the forum thread. |
Excel tip:Switching Between SpreadsheetsAs the Alt+Tab key switches between loaded applications or files, Ctrl+Tab switches between loaded or open Excel files. Hold down the Ctrl key until you have tabbed to the correct spreadsheet. |