+ Reply to Thread
Results 1 to 4 of 4

how do you move a row based on info in a column?

  1. #1
    Registered User
    Join Date
    08-19-2010
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    97

    how do you move a row based on info in a column?

    Hi,
    i have a sheet where when something becomes invoiced an "S" goes into column R. When the "S" is entered into column R i want that from A:AC of that row to get cut and move into ideally a different workbook, but if that's too complicated then just a tab called "Invoiced History" in the same workbook.

    I would want a macro, and I tried writing one but it only cut and moved the first row of the data.

    thanks.

  2. #2
    Forum Moderator - RIP Richard Buttrey's Avatar
    Join Date
    01-14-2008
    Location
    Stockton Heath, Cheshire, UK
    MS-Off Ver
    Office 365, Excel for Windows 2010 & Excel for Mac
    Posts
    29,464

    Re: how do you move a row based on info in a column?

    Hi,


    I think the approach I'd take is create a macro which:

    a) Filters the data on column R for the value 'S'.
    b) Opens up the archiving workbook.
    c) Cut and paste the whole of the filtered cells from A??:AC?? into the next available row in the archiving workbook.
    d) Save and close the archiving workbook.
    e) Delete the A??:AC?? cells, or the whole row if AC is the last column.
    f) Removes the filter.

    HTH
    Richard Buttrey

    RIP - d. 06/10/2022

    If any of the responses have helped then please consider rating them by clicking the small star icon below the post.

  3. #3
    Registered User
    Join Date
    08-19-2010
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: how do you move a row based on info in a column?

    Conceptually I totally get what you're saying, I just can't seem to execute.

    May I have the actual code?

  4. #4
    Registered User
    Join Date
    08-19-2010
    Location
    new york
    MS-Off Ver
    Excel 2010
    Posts
    97

    Re: how do you move a row based on info in a column?

    i think i figured it out, the only thing is that it requires the invoiced tab to have at least 2 rows of data and i'm not sure why:
    Sub MoveClosed()
    Sheets("Picks").Select
    Selection.AutoFilter Field:=1, Criteria1:="S"
    Range("A2:Z2").Select
    Range(Selection, Selection.End(xlDown)).Select
    Range(Selection, Selection.End(xlToRight)).Select
    Selection.Copy
    Sheets("Invoiced").Select
    Range("A1").Select
    ' The next 3 steps require that there be at least two rows of data in Completed
    Selection.End(xlDown).Select
    ActiveCell.Offset(1, 0).Range("A1").Select
    ActiveSheet.Paste
    Sheets("Picks").Select
    Application.CutCopyMode = False
    Selection.EntireRow.Delete
    Selection.AutoFilter Field:=1
    ActiveCell.Select
    End Sub

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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