+ Reply to Thread
Results 1 to 7 of 7

Help with dynamic array in VBA

  1. #1
    Registered User
    Join Date
    10-10-2012
    Location
    Cz
    MS-Off Ver
    Excel 2003
    Posts
    3

    Help with dynamic array in VBA

    Hello, Could you help me please with this code:
    Please Login or Register  to view this content.
    Program: Enter a series of numbers terminated by zero. Determine the smallest and write down how many times in a row repeats

    Problems are: When I try my program with StepInto, Redim preserves pole(i) shows "subscript out of range", when i insert variable x to array1 at the end of program then it shows value of array1 properly but when program goes to ReDim preserve array1(i) then value is again 0. Array is still 0 and i canīt determine the smallest number (If x < array1(i) Then).

    Sorry my english is bad.
    Last edited by arlu1201; 10-11-2012 at 02:37 PM.

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Help with dynamic array in VBA

    you don't need array
    Please Login or Register  to view this content.
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    10-10-2012
    Location
    Cz
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Help with dynamic array in VBA

    Thank you for your advice but i must do it with array, i donīt know how to do it with dynamic array please help me.

  4. #4
    Forum Expert mike7952's Avatar
    Join Date
    12-17-2011
    Location
    Florida
    MS-Off Ver
    Excel 2007, Excel 2016
    Posts
    3,520

    Re: Help with dynamic array in VBA

    Homework uh?
    Thanks,
    Mike

    If you are satisfied with the solution(s) provided, please mark your thread as Solved.
    Select Thread Tools-> Mark thread as Solved.

  5. #5
    Registered User
    Join Date
    10-10-2012
    Location
    Cz
    MS-Off Ver
    Excel 2003
    Posts
    3

    Re: Help with dynamic array in VBA

    Yes, homework, i tried reprogram this code took me about 3 hours, but still same result, i donīt know what i did wrong, please any advices, thank you very much.

  6. #6
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: Help with dynamic array in VBA

    With your code you never use the array, the input numbers and the min value are stored in strings
    Last edited by patel45; 10-11-2012 at 02:33 PM.

  7. #7
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,166

    Re: Help with dynamic array in VBA

    JaxFrings,

    Welcome to the forum.

    I have added code tags to your first post. As per forum rule 3, you need to use them whenever you put any code in your post. Please add them in future. If you need more information on how to use them, check my signature below this post.
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1