+ Reply to Thread
Results 1 to 4 of 4

Loop Sub until debug

Hybrid View

  1. #1
    Registered User
    Join Date
    02-03-2014
    Location
    Newcastle Upone Tyne, England
    MS-Off Ver
    Excel 2003
    Posts
    7

    Loop Sub until debug

    I have a sub that does some formatting and then pastes a result at the first empty cell after the information that is there.

    How can i do a look for this so it does this continuously until you get a Debug because there are no more results in the formatting.

    I was looking at Loops but got lost in circles in them (haha)

    Once the looks are compete i Just want to end the sub.

    Thanks

  2. #2
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Loop Sub until debug

    could u please provide the macro which u are using...
    Thanks - Naveed
    -----------------------------
    If the suggestion helps you, then Click * to Add Reputation
    To Attach File: Go Advanced>>Manage Attachments>>Add Files (In Top Right Corner)>>SelectFiles>>.........Locate Your File(s)>>Upload Files>>Done (In Bottom Right)
    1. Use [code] code tags [\code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    2. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

  3. #3
    Registered User
    Join Date
    02-03-2014
    Location
    Newcastle Upone Tyne, England
    MS-Off Ver
    Excel 2003
    Posts
    7

    Re: Loop Sub until debug

    I know there are easier ways to create this sub etc but in fairly new to VBA and its a starting point.
    Basically it searches for someones name depending on a date and if they have a "h" under their name for that date.
    I then copy their name and paste it, but i just need to keep this looping over till there is nothing left to find.


    Sub CSROff()
    'Identifies date for days of this week
    wkDateMon = Worksheets("Cover - This Week").Range("b4")
    wkDateTue = Worksheets("Cover - This Week").Range("b5")
    wkDateWed = Worksheets("Cover - This Week").Range("b6")
    wkDateThu = Worksheets("Cover - This Week").Range("b7")
    wkDateFri = Worksheets("Cover - This Week").Range("b8")
    
        'Activates correct worksheet
    Worksheets("HOL_SICK").Activate
    
    
                'Counts the number CSR's on the department
        CSRCount = Range("b8", Range("b8").End(xlToRight)).Count
                'Finds the todays date in the list of dates
        MnSchDate = Range(Range("a8"), Range("a8").End(xlDown)).Find(wkDateMon).Select
                'Counts the number of rows the date is from the top
        MnSchCount = Range(ActiveCell, Range("a9")).Count
                'Finds the first "h" in the row for the first person off that day
        MnSchHol = Range(ActiveCell, ActiveCell.Offset(0, 99)).Find("h").Select
                'Changes the "h" in the cell to "X" so its not picked up when searching for the next CSR
        ActiveCell = "X"
                'Uses the MnSchCount above to move to the CSR Name and copies
        MnCSROff = ActiveCell.Offset(-MnSchCount, 0).Select.Copy
           'ActiveCell.Copy
            'Moves to past the last date in the series and pasts the CSR name from above on 1st free cell
        Range("A8").End(xlDown).Offset(1).PasteSpecial
    Moderator's note: Please take the time to review our rules. There aren't many, and they are all important. Rule #3 requires code tags. I have added them for you this time because you are a new member. --6StringJazzer
    Last edited by 6StringJazzer; 05-14-2015 at 09:59 AM. Reason: code tags

  4. #4
    Valued Forum Contributor Naveed Raza's Avatar
    Join Date
    11-04-2012
    Location
    India, Hyderabad
    MS-Off Ver
    Excel, Access 2007/2010
    Posts
    1,338

    Re: Loop Sub until debug

    please edit your post and Add Code tag to your code............ please edit it and attached sample workbook

+ 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. Pause and debug at a particular point in a loop
    By ualdriver in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-08-2015, 12:12 AM
  2. VBA Code Runs in Debug Mode But Returns Type Mismatch Error Outside Debug Mode
    By valerie.k.chiang in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 01-24-2014, 03:48 PM
  3. [SOLVED] Debug: How to debug this code?
    By reach78 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 09-25-2013, 07:16 AM
  4. How do debug a loop?
    By max3732 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 09-24-2013, 04:27 PM
  5. [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

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