+ Reply to Thread
Results 1 to 8 of 8

VBA Loop through until

  1. #1
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    VBA Loop through until

    Morning all,

    I was wondering if anyone could help me as i'm now stuck

    I have two columns (A start time and finish time) is there some VBA that looks up the start time across a timeline - finds it, places a 1 then looks at the finish time, looks up across the timeline and puts a 1 + Everything between?

    *Sorry i forgot to add that From = Start Time - Top Row and To = Finish Time - Bottom row

    Also the list is never going to be a set size...

    Hopefully this makes sense?! I've manually done the first one in the example..

    Capture.PNG

    Any help on this would be fantastic!

    Thanks
    Attached Files Attached Files
    Last edited by jsneak; 10-11-2018 at 03:48 AM.

  2. #2
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA Loop through until

    I believe you could do this with formulas but you're asking for VBA so here's a possible solution:

    Please Login or Register  to view this content.
    WBD
    Office 365 on Windows 11, looking for rep!

  3. #3
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,944

    Re: VBA Loop through until

    Please Login or Register  to view this content.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  4. #4
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: VBA Loop through until

    Absolute legend! Thank you so much... I'm going to work through it and see how the hell it works (Wish me luck)

    Thanks again!

  5. #5
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA Loop through until

    Hey.

    If it helps, here's some annotated code:

    Please Login or Register  to view this content.
    WBD

  6. #6
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: VBA Loop through until

    Thats brilliant - thanks mate

  7. #7
    Forum Expert WideBoyDixon's Avatar
    Join Date
    10-03-2016
    Location
    Sheffield, UK
    MS-Off Ver
    365
    Posts
    2,182

    Re: VBA Loop through until

    If your'e happy with the solution, you can mark it as solved. I've just noticed your location too ... ha!

    WBD

  8. #8
    Forum Contributor
    Join Date
    08-22-2013
    Location
    Sheffield
    MS-Off Ver
    Excel 2010
    Posts
    161

    Re: VBA Loop through until

    Solution worked like a dream, many thanks mate

    Oh yea - Steel City!

+ 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. Replies: 13
    Last Post: 07-08-2018, 05:22 AM
  2. Comparing Similiar DataSets and Calling a Function From a Loop Within a Loop
    By Mark123456789 in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 08-23-2016, 11:27 AM
  3. [SOLVED] (Beginner help) For loop inside do loop that displays information from reference sheet.
    By lediable007 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-08-2016, 03:20 PM
  4. [SOLVED] Auto email loop with formatted table data breaking on second loop VBA
    By Who_else in forum Excel General
    Replies: 6
    Last Post: 03-24-2016, 06:22 AM
  5. [SOLVED] VBA to loop within a loop of multiple blocks of data (currentregion) ... Expert needed
    By Jim885 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 03-20-2016, 08:28 PM
  6. [SOLVED] Copy dynamically changing column and Paste using VBA Loop (Loop within Loop)
    By nixon72 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 02-12-2013, 12:46 PM
  7. Why did an inner loop variable start overwriting the outer loop range suddenly?
    By 111StepsAhead in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-16-2012, 03:24 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