+ Reply to Thread
Results 1 to 5 of 5

Moving entire row to another sheet when column shows "closed" value

  1. #1
    Registered User
    Join Date
    04-16-2013
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    21

    Moving entire row to another sheet when column shows "closed" value

    Hi guys,

    Have been reading through streams of similar threads on here and have tried a few to see if it can accommodate what I need it to do, but am getting nowhere.

    As I am at work, it does not allow me to upload the file due to restrictions on uploading. However, the spreadsheet is fairly simple so should be able to describe it.

    The main sheet is called "Investigation Court Apps". An entry is made into each row and the status shows as "Open" in Column A, until a final closure date is input in Column Z, at which point the entry in Column A changes to "Closed". This is achieved with the following IF statement in Column A.
    =IF(B3="","",IF(ISNUMBER($Z3),"Closed","Open"))

    So that part is all automated. What I need is some VBA coding or macro (might be same thing but completely new to all this) that when the value in Column A changes to "Closed" the whole row moves over to "Sheet3". Once the row has been moved over, I want to ensure there are no blank rows also.

    I have tried the following amongst others:

    Sub MoveToSheet3()
    Dim C1 As Range
    Dim RowNum As Integer

    For Each C1 In Sheets("Investigations Court Apps").Range("N1:N" & Range("A65536").End(xlUp).Row)
    If Cll = 0 Then
    RowNum = Sheets("Sheet3").Range("A65536").End(xlUp).Row + 1
    Cl.EntireRow.Copy Destination:=Sheets("Sheet3").Cells(RowNum, 1)
    Cl.EntireRow.Delete
    End If
    Next Cl
    End Sub

    I am unsure what part I need to adjust, and have only adjusted the bits that I think need adjusting so may just need tweaking or maybe wrong altogether.

    Also if anyone is able to help, please give dummies instructions on how to apply the code or where to copy to. As I have only recently learnt formulas, so VBA and its function are way over my head. I know to open VBA its Alt+F11 and to close Alt+Q, but thats about it. Just kidding but you know what I mean.

    Thank you as always and look forward to trying a few more things.

    Thanks and Kindest Regards

  2. #2
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Moving entire row to another sheet when column shows "closed" value

    Try:
    Please Login or Register  to view this content.
    let Source = #table({"Question","Thread", "User"},{{"Answered","Mark Solved", "Add Reputation"}}) in Source

    If I give you Power Query (Get & Transform Data) code, and you don't know what to do with it, then CLICK HERE

    Walking the tightrope between genius and eejit...

  3. #3
    Registered User
    Join Date
    04-16-2013
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Moving entire row to another sheet when column shows "closed" value

    Hi OllyXLS,

    I tried that and it did nothing? I right clicked the investigations court app sheet, pressed view code and entered the above. I saved and closed and on restart enabled macros but it just did nothing unfortunately.

    Am I doing something wrong?

    Thanks

    Imran

  4. #4
    Forum Expert Olly's Avatar
    Join Date
    09-10-2013
    Location
    Darlington, UK
    MS-Off Ver
    Excel 2016, 2019, 365
    Posts
    6,284

    Re: Moving entire row to another sheet when column shows "closed" value

    Sorry, do you have column Z formatted as a Date? Just noticed your check for column B, too... So try this:

    Please Login or Register  to view this content.
    It's triggered by the value in column Z changing - if this changes to a date, and the value in column B (same row) is not blank, then it will copy the entire row to the next unused row in Sheet 3, then delete the row from the active sheet.

  5. #5
    Registered User
    Join Date
    04-16-2013
    Location
    Birmingham
    MS-Off Ver
    Excel 2003
    Posts
    21

    Re: Moving entire row to another sheet when column shows "closed" value

    Hi OllyXLS,

    Yes Row Z has data validation so it only accepts dates. I tried the coding once again it did nothing unfortunately.

    Is there anyway to upload my spreadsheet on here. I have had the upload restriction removed. But when I go to upload via the manage attachments, they simply dont appear after pressing upload.

    I think it will make life easier if it was uploaded as don't wish to waste any more of your time on this.

    Thanks and Regards

    Imran

+ 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] Moving entire rows to new sheet once item has a status of "Sold"
    By Linklog in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 09-30-2013, 04:10 PM
  2. [SOLVED] Macro to delete entire roll when the cell has "CLOSED" text
    By ricdamiani in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 08-12-2013, 02:02 AM
  3. Moving entire row from the "Schedule" worksheet to "Completed" worksheet
    By Redveck in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-25-2012, 02:30 PM
  4. Applying a "Left" formula to an entire column with heading "ValueCol"
    By aad401 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-12-2012, 04:14 PM
  5. Pulling an entire Column "IF" a cell contains "x"
    By jdskin2 in forum Access Programming / VBA / Macros
    Replies: 0
    Last Post: 02-14-2012, 01:31 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