+ Reply to Thread
Results 1 to 5 of 5

If "Completed" then move entire row to "Completed" worksheet

  1. #1
    Registered User
    Join Date
    05-02-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    If "Completed" then move entire row to "Completed" worksheet

    I am working on an excel spreadsheet that if "complete" is selected in column a, then the entire row moves to the "Completed" worksheet and the row is deleted. Additionally, I imagine the same sort of code is needed so that; if a "division" is selected in column d, then the data is replicated in the appropriate division worksheet along with updates in the division specific worksheet is also replicated on the "Agency Update".

    Any help that can be offered would be grealty appreciated.

    Reed1620
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    09-22-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    36

    Re: If "Completed" then move entire row to "Completed" worksheet

    Sub My_macro ()
    ActiveCell.SpecialCells(xlLastCell).Select
    LastRow = Activecell.Row

    For Row = 1 to LastRow
    CellContents = Cell(Row, 1)
    If CellContents = "Completed" then

    *record the next bit*
    -cut row
    -move to other sheet and make it the active sheet
    -use 'ctrl+end' to find the last filled row and add 1 (ActiveCell.SpecialCells(xlLastCell).Select)
    -paste cut row
    -go back to the first tab and make that active again

    end if
    Next Row
    end Sub

  3. #3
    Registered User
    Join Date
    05-02-2013
    Location
    Houston, TX
    MS-Off Ver
    Excel 2010
    Posts
    2

    Re: If "Completed" then move entire row to "Completed" worksheet

    Red Spot,

    I apologize, I guess I am not as familiar as I thought. Could you please provide some guidance on executing the above code.

  4. #4
    Registered User
    Join Date
    09-22-2012
    Location
    The Netherlands
    MS-Off Ver
    Excel 2003 & Excel 2007
    Posts
    36

    Re: If "Completed" then move entire row to "Completed" worksheet

    Google is your friend, my friend

    I'm a true noob in VBA (well, sort of) and I know this simply cause of trial and error.

    Anway, quick and dirty, line for line:
    Start the Macro
    Determine what the last row & cell are in the active sheet
    Get the row from the last cell in the sheet

    Loop from row 1 to the lastrow
    Get the contents from the cell
    Check if the cell contents = completed


    Try to figure out what steps you need to take to get things done and google every (small) step.

  5. #5
    Forum Contributor arlu1201's Avatar
    Join Date
    09-09-2011
    Location
    Bangalore, India
    MS-Off Ver
    Excel 2003 & 2007
    Posts
    19,167

    Re: If "Completed" then move entire row to "Completed" worksheet

    Ok, you have multiple requirements here - lets get them all straightened out -

    1. You want all rows with status "Completed" moved to the completed sheet, in which sheet should we check for status as "Completed" ?

    2. From which sheet should the division wise data be copied to the other sheets?
    If I have helped, Don't forget to add to my reputation (click on the star below the post)
    Don't forget to mark threads as "Solved" (Thread Tools->Mark thread as Solved)
    Use code tags when posting your VBA code: [code] Your code here [/code]

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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