+ Reply to Thread
Results 1 to 9 of 9

How can I loop this Select statement?

  1. #1
    Registered User
    Join Date
    01-28-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    8

    How can I loop this Select statement?

    Heya guys

    I have values in column A, and I'd like to have these values run through a formula that I've pre-determined using a Select Case statement, and display the corresponding value in Column B. I just don't know how I can do it. I didn't want to write a massive IF function, so opted for VBA.

    My code for the Select Statement (which works great, I just need to loop)...

    Please Login or Register  to view this content.
    Last edited by RynMan; 02-24-2009 at 10:53 PM.

  2. #2
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: How can I loop this Select statement?

    Please take a few minutes to read the Forum Rules, and then edit your post to wrap your code with Code Tags.
    Entia non sunt multiplicanda sine necessitate

  3. #3
    Registered User
    Join Date
    01-28-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: How can I loop this Select statement?

    My apologies - that's much better.

  4. #4
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: How can I loop this Select statement?

    Need to loop how much?
    Like....
    Please Login or Register  to view this content.
    ?
    =IF(AND(OR(BLONDE,BRUNETTE,REDHEAD),OR(MY PLACE,HER PLACE),ME),BOW-CHICKA-BOW-WOW,ANOTHER NIGHT ON THE INTERNET)

  5. #5
    Registered User
    Join Date
    01-28-2009
    Location
    Brisbane
    MS-Off Ver
    Excel 2007
    Posts
    8

    Re: How can I loop this Select statement?

    Quote Originally Posted by mewingkitty View Post
    Need to loop how much?
    Like....
    Please Login or Register  to view this content.
    ?
    Yeah basically til it reaches an empty cell. Would that work?

  6. #6
    Forum Contributor mewingkitty's Avatar
    Join Date
    09-29-2008
    Location
    Fort McMurray, Alberta, Canada
    MS-Off Ver
    Excel 2003
    Posts
    949

    Re: How can I loop this Select statement?

    Yup, that it will.

    do until <condition>

    loop

    is handy, just don't forget to add a + to your integer once for each loop, otherwise you sit there like me, staring blankly at the screen, wondering why it's frozen and not moving past the first cell

    IE
    Please Login or Register  to view this content.
    will show message boxes 1, 2, 3 etc. up UNTIL x = 5.
    once x = 5, it will drop the loop, so you'll only get a msgbox up to 4.
    If you're like me and you still forget to put in the x = x + 1, you just get msgboxes 1, 1, 1, 1, 1, 1, and then you start to figure it out :P

  7. #7
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: How can I loop this Select statement?

    heres another method
    Assumes data starts in A1

    Please Login or Register  to view this content.
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  8. #8
    Registered User
    Join Date
    02-23-2009
    Location
    malaysia
    MS-Off Ver
    Excel 2003
    Posts
    1

    Re: How can I loop this Select statement?

    i have a problem to separate data.argon 10,oxygen 19,oxygen 20. this data,is view in excell.i import this data to access 2003,then i must separate that using looping.i want from this data become in 2 places in database. like,
    textbox type=argon,oxygen,oxygen
    textbox quantity=10,19,20
    could you all help me and show the example coding?

  9. #9
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: How can I loop this Select statement?

    maya

    Welcome to Exceltip forum

    Please take a couple of minutes and read ALL the Forum Rules

    Your post does not comply with Rule 2 of our Forum RULES. Don't post a question in the thread of another member -- start your own thread. If you feel it's particularly relevant, provide a link to the other thread.

+ 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