Results 1 to 10 of 10

Loop with selection.delete and InStr is ending early

Threaded View

  1. #1
    Registered User
    Join Date
    10-24-2012
    Location
    Guelph, ON
    MS-Off Ver
    Excel 2010
    Posts
    41

    Loop with selection.delete and InStr is ending early

    Hello: I can not for the life of me figure this out. I have even switched the loop to go from Last row to 2 (starting from bottom up) and no matter what I do my loop ends before it is done. I'm not sure if it has to do with the delete nature of the command?

    Background: I'm cleaning up a large set of data. I've provided a small sample to illustrate my problem.

    The first loop appears to work flawlessly. The first loop scrolls through and shifts any cell containing ":" to the right. Next I want to scroll through Column C and remove and shift cells to the left for cells with text containing "photo". This second loop never makes it to the end. I have tried re-defining the last row, ranges, etc. Would anyone have any brilliant ideas?

    I've attached the sample spreadsheet for you with the VBA code.

    Original sample data is on one tab and you can see where the code ends in Column C on the Cleaned Up data tab.

    Hopefully this makes sense.

    Thanks,
    Stef,
    Attached Files Attached Files

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] instr function if loop to find data
    By diyVBA in forum Excel Programming / VBA / Macros
    Replies: 18
    Last Post: 05-06-2020, 11:20 AM
  2. [SOLVED] Macro Ending Early - When Using Range.Value on some macros?
    By bkm2016 in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 05-28-2017, 04:41 PM
  3. Loop finishing too early!!
    By newbi004 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-16-2013, 01:23 PM
  4. [SOLVED] How to break out of a For loop early?
    By geophysicist in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-12-2013, 11:08 PM
  5. For Exit Loop in instr function
    By drcheaud in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-21-2011, 03:24 PM
  6. Ending macro early
    By TedH in forum Excel Programming / VBA / Macros
    Replies: 8
    Last Post: 01-20-2009, 11:45 AM
  7. Ending a macro early conditionally on one cell being blank
    By Rokuro kubi in forum Excel General
    Replies: 3
    Last Post: 05-26-2006, 09:15 AM

Tags for this Thread

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