+ Reply to Thread
Results 1 to 4 of 4

Help with loop

  1. #1
    Registered User
    Join Date
    08-03-2012
    Location
    35.0456° N, 85.3097° W
    MS-Off Ver
    2010
    Posts
    36

    Help with loop

    Wanting the input box repeat four times, that part of code works. However, I want the new values to be entered on the next empty row of worksheet of column 5 or ("E").
    Ex:
    Enter Weight of cavity #1
    Answer: 325
    Enter Weight of cavity #2
    Answer: 328
    Enter Weight of cavity #3
    Answer: 563
    Enter Weight of cavity #4
    Answer: 569

    Each answer should advance down in column 5.

    Please Login or Register  to view this content.
    Hope that make sense. Thanks to all for help.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,936

    Re: Help with loop

    Cells(emptyRow, 5).Value = Weight

    If Weight is not used further, then:
    Please Login or Register  to view this content.
    Last edited by protonLeah; 08-03-2012 at 10:59 PM.
    Ben Van Johnson

  3. #3
    Forum Expert
    Join Date
    07-20-2011
    Location
    Mysore, India.
    MS-Off Ver
    Excel 2019
    Posts
    8,710

    Re: Help with loop

    Change your code

    Please Login or Register  to view this content.

    Into

    Please Login or Register  to view this content.

  4. #4
    Forum Guru TMS's Avatar
    Join Date
    07-15-2010
    Location
    The Great City of Manchester, NW England ;-)
    MS-Off Ver
    MSO 2007,2010,365
    Posts
    48,167

    Re: Help with loop

    To clarify, Weight is a variable, type Variant as it is not defined. As such, it does not have a Value property.

    So, the first solution avoids the use of the variable on the premise that it is only needed for this step.

    The second solution removes the offending Value property.

    Note that, as EmptyRow is determined outside the loop, all the results will go in the same cell. You probably need to make it: Cells(EmptyRow+i, 5).value


    Regards, TMS
    Trevor Shuttleworth - Retired Excel/VBA Consultant

    I dream of a better world where chickens can cross the road without having their motives questioned

    'Being unapologetic means never having to say you're sorry' John Cooper Clarke


+ 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