+ Reply to Thread
Results 1 to 7 of 7

Do loop In between two values until Condition met

  1. #1
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Do loop In between two values until Condition met

    hi,
    i want to do loop in between two values until condition met

    for example...

    first value is Range("B1").value and second value is Range("B2")
    B1 = 10
    B2 = 20
    then in last blank row of range("a4:a100") run this loop from 10 to 20,
    Stop looping if last blank row of range("a4:a100").offset(0,15) > 0
    Please Login or Register  to view this content.
    thanks
    hope some one will help
    Use Code-Tags for showing your code :
    Please mark your question Solved if there has been offered a solution that works fine for you
    If You like solutions provided by anyone, feel free to add reputation using STAR *

  2. #2
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Do loop In between two values until Condition met

    Attaching a sample workbook enables others to work on your problem:

    To attach a sample workbook. Make sure there is just enough data to make it clear what is needed. Include BEFORE/AFTER sheets if needed to show the process you're trying to complete or automate. Remember to desensitize the data.

    Click on GO ADVANCED and click "manage attachments" to open the upload window.


    To add a file to a post

  3. #3
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Do loop In between two values until Condition met

    Thank for the reply
    here is sample workbook
    1.JPG
    Attached Files Attached Files

  4. #4
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Do loop In between two values until Condition met

    Still need help understanding what you are looking for.

  5. #5
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Do loop In between two values until Condition met

    How to generate number in between 1-40 in cell b1 using loop

  6. #6
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,475

    Re: Do loop In between two values until Condition met

    You have
    b1=10
    b2=20

    Then you say you want to loop 10 to 40

    The you say to stop at 13 because C10.offset(,1)>0


    -Where does the 40 come from?
    -C10.offset(,1) =0 but C7.offset(,1) >0

    Can you clarify your question?

  7. #7
    Forum Contributor HaroonSid's Avatar
    Join Date
    02-28-2014
    Location
    india
    MS-Off Ver
    Excel 2013
    Posts
    2,080

    Re: Do loop In between two values until Condition met

    I found a code, just need to modify according my need
    Please Login or Register  to view this content.
    Above code is working as I need
    Just don't want to generates random numbers
    I want to generates sequentially number

    For example if b1 =10 and b2 = 15
    Then generate number
    10
    11
    12
    13
    15
    16
    17
    18
    19
    20
    THANKS

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Skip in loop if condition in loop is met
    By jakopak in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-17-2015, 10:41 AM
  2. [SOLVED] Do-Until Loop with multiple condition
    By bf0109 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 12-17-2012, 05:12 AM
  3. TextToColumns in a loop (If a condition is met)
    By cfoxc in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 12-11-2012, 12:46 PM
  4. If condition not working in the loop
    By SunOffice in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-15-2011, 07:22 AM
  5. Loop until condition is met
    By Toimia in forum Excel Formulas & Functions
    Replies: 4
    Last Post: 03-08-2011, 08:39 PM
  6. Add a second condition to loop
    By Casey in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 07-06-2006, 07:00 PM
  7. Using For loop to condition
    By bundyloco in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2005, 03:05 PM

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