+ Reply to Thread
Results 1 to 4 of 4

loop question

  1. #1
    Registered User
    Join Date
    03-02-2007
    Posts
    21

    loop question

    Hi all,

    Ok I am trying to establish a loop whereby after every 6th count a variable is changed.

    Therefore:-
    if count = 1 to 6 then yval = 20
    if count = 7 to 12 then yval = 160
    if count = 13 to 18 then yval = 300

    ...carries on adding 140 to yval with each count range of 6.

    The count is not fixed and continues until it reaches a blank cell.

    I thought about dividing count by 6 and rounding down to get whole numbers that I could multiply yval by each time but there is no easy way to round down in vb that i can see.

    Any ideas would be appreciated.

    Thanks,
    Gboy

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983
    Add these commands after your counter is increased

    Please Login or Register  to view this content.
    It sounds like you are intending to use a Do type loop

    Here is a way to loop using a For type loop where you get the end row number before you start the loop

    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.

  3. #3
    Registered User
    Join Date
    03-02-2007
    Posts
    21
    I like that, very clever!

    Thanks for your help.

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

    If you are refering to (counter Mod 6) as being very clever I thought so to when I seen it posted in another thread a couple of days ago.

+ 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