+ Reply to Thread
Results 1 to 3 of 3

Code not working

  1. #1
    Forum Contributor
    Join Date
    06-17-2010
    Location
    Donemana, NI
    MS-Off Ver
    Excel 2007
    Posts
    386

    Code not working

    Hi,
    Can anyone tell me why the below code is not working, i am looking to move a row from Sheet "Reminders" to sheet "Completed" if "D51", "D54", "D55", "D56", "D58" is placed in columns M2:W but it doesnt work when I run it, I have attached the worksheet with the data in it and have named the required macro "Completed".
    Any help would be greatly appreciated.
    Thanks in advance
    Johnny

    Please Login or Register  to view this content.
    Attached Files Attached Files

  2. #2
    Forum Guru xlnitwit's Avatar
    Join Date
    06-27-2016
    Location
    London
    MS-Off Ver
    Windows: 2010; Mac: 16.13 (O365)
    Posts
    7,085

    Re: Code not working

    Hi,

    You might try this version

    Please Login or Register  to view this content.
    It is best to keep deletions to a minimum but, if you did need to delete a row at a time, you should loop backwards through the data so as to avoid skipping rows as they move up. Additionally, your version of the code was using column A to find the next row to write to but column A is blank in your example and therefore the rows keep overwriting the same location.
    Don
    Please remember to mark your thread 'Solved' when appropriate.

  3. #3
    Forum Guru Norie's Avatar
    Join Date
    02-02-2005
    Location
    Stirling, Scotland
    MS-Off Ver
    Microsoft Office 365
    Posts
    19,643

    Re: Code not working

    You have no values in column A so the row you are copying will always goto the first row on 'Completed'.

    Try either using a different column to determine the destination, or set the destination at the start and whenever you find a match move it down a row.

    Here's an example of the 2nd suggestion.
    Please Login or Register  to view this content.
    If posting code please use code tags, see here.

+ 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. [SOLVED] Pattern Building VBA Code - Working code, would like to use cleaner code
    By Benisato in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-10-2015, 03:05 PM
  2. [SOLVED] Vba code working in workbook module but not working from personal.xlb
    By satputenandkumar0 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 04-19-2014, 05:47 AM
  3. Replies: 1
    Last Post: 11-13-2013, 10:28 AM
  4. [SOLVED] Code are not working
    By abjac in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2013, 10:33 AM
  5. Removing code line stops code working?!?!?
    By adamj1910 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-31-2012, 02:36 PM
  6. [SOLVED] VBA Code (colums to row, autofill) stop working in row 294 when new cable code appear
    By sknifseht in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 10-29-2012, 05:27 AM
  7. Code for email alerts from excel isn't working, wrong code possibly?
    By jessthorogood in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-27-2012, 01:45 AM

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