+ Reply to Thread
Results 1 to 3 of 3

VBA Loops

  1. #1
    Registered User
    Join Date
    12-05-2010
    Location
    la, ca
    MS-Off Ver
    Excel 2007
    Posts
    2

    VBA Loops

    Hi there

    I was wondering if anyone can help me with loops. I'm just learning this and am working on an exercise for class.

    Basically, the problem states that an aluminum structure is dipped in acid and loses 1% in weight each time it is dipped. The overall weight cannot be under 10 lbs so I would have to loop until the weight is about 10 lbs. Then find final weight depending on what the user has inputted prior to the structure being dipped (original weight).

    my code so far:
    Please Login or Register  to view this content.
    I'm not really sure about what to do to make it work.
    Any help is greatly appreciated.
    Last edited by randomperson15; 12-05-2010 at 11:21 PM.

  2. #2
    Forum Expert pike's Avatar
    Join Date
    12-11-2005
    Location
    Alstonville, Australia
    MS-Off Ver
    2016
    Posts
    5,330

    Re: Edited: VBA Loops

    Hi randomperson15
    first change the dims to doubles to cope with the numbers you are working with
    long reserve memory for -2,147,483,648 to 2,147,483,647 where
    double is 4.94065645841247E-324 to 1.79769313486232E308
    one percent of some thing will be a decimal

    with the loop you need to keep calculating and reducing j but one percent
    Please Login or Register  to view this content.
    the first place to find examples of code is with the VBA help. just highlight the "Do" in the code and press "F1".
    If the solution helped please donate to RSPCA

    Site worth visiting: Rabbitohs

  3. #3
    Registered User
    Join Date
    12-05-2010
    Location
    la, ca
    MS-Off Ver
    Excel 2007
    Posts
    2

    Re: Edited: VBA Loops

    Thank you so much, Pike. Your format is way better than mine as it isn't all over the place with more variables.
    Last edited by randomperson15; 12-06-2010 at 12:55 AM.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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