+ Reply to Thread
Results 1 to 9 of 9

Thread: Cut, Paste to other Sheet, Delete Macro

  1. #1
    Registered User
    Join Date
    08-11-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    5

    Cut, Paste to other Sheet, Delete Macro

    First off, new to macros but have had success with recording a few and using a few from this forum. Now for what I am trying to accomplish and hope somebody can help. I have a sheet titled "Floor Plan". Within "Floor Plan", Column "K" will contain currency formatting until the date it is paid at which time an input person will change the cell to "Paid xx/xx/xx". I would like to create a macro that we could choose when to initiate it, beginning on row 9, searching for any cell in column "K" that contains the word "Paid" or "PAID" and cut the entire row, paste it to the next available row in a sheet named "Paid TRs". I would then like the blank rows on "Floor Plan" to be deleted and (xlUP[?]). A button to run this would be nice but a keyboard shortcut will also work.

    This is my first time posting so please forgive me if my jargon is insufficient!
    Last edited by ruthieag; 08-26-2011 at 04:06 PM.

  2. #2
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,226

    Re: Cut, Paste to other Sheet, Delete Macro

    I would use Excel's AutoFilter for this. This is easy to construct when looking at your real layout with a reasonable amount of sample data in it.

    Click GO ADVANCED and use the paperclip icon to post up a copy of your workbook.
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  3. #3
    Registered User
    Join Date
    08-11-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Cut, Paste to other Sheet, Delete Macro

    Thank you for your willingness to help. The attached is my work in progress. It has a current macro in it that will add a row to the end of my Floor Plan sheet with formulas needed. I have estimated the most number of rows needed for data with our size of institution would be 100. There will be a few users of this workbook with different needs so I want to keep the Floor Plan sheet looking clean.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-11-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Cut, Paste to other Sheet, Delete Macro

    I attached my workbook previously, however, unsure if I used the correct method so you would be notified of such.

  5. #5
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,226

    Re: Cut, Paste to other Sheet, Delete Macro

    This should do it:
    Option Explicit
    
    Sub TransferPAID()
    'Jerry Beaucaire   8/17/2011
    
    Dim LR As Long
    
    With Sheets("Floor Plan")
        .AutoFilterMode = False
        .Rows("8:8").AutoFilter
        .Rows("8:8").AutoFilter Field:=11, Criteria1:="=Paid*"
        LR = .Range("A" & .Rows.Count).End(xlUp).Row
        If LR > 8 Then
            .Range("A9:A" & LR).EntireRow.Copy Sheets("Paid TRs").Range("A" & Rows.Count).End(xlUp).Offset(1)
            .Range("A9:A" & LR).SpecialCells(xlVisible).EntireRow.Delete xlShiftUp
        End If
        .AutoFilterMode = False
    End With
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  6. #6
    Registered User
    Join Date
    08-11-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Cut, Paste to other Sheet, Delete Macro

    Works great! Thank you for your time and effort. It's great that you share your knowledge with those of us that only think it can happen.

  7. #7
    Registered User
    Join Date
    08-11-2011
    Location
    Indianapolis, Indiana
    MS-Off Ver
    Excel 2003
    Posts
    5

    Re: Cut, Paste to other Sheet, Delete Macro

    I was ready to roll out my project and performed a final test. When I placed "Paid" in cell K:9, the auto filter does not work correctly with The Option Explicit - Sub TransferPaid macro. It seems to work well in all other cells in column K. The other issue I have, which is not as important, is that after I have "transferred paid" rows and then try to "insert rows w/formulas", there are empty rows between my last row with data and my inserted row with formulas. I have attached the latest version of my workbook. The Macro Sheet will be hidden to other users in final version.
    Attached Files Attached Files

  8. #8
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,226

    Re: Cut, Paste to other Sheet, Delete Macro

    Try changing this one line:
                     .Range("A9:A" & LR).EntireRow.Delete xlShiftUp
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

  9. #9
    Forum Guru JBeaucaire's Avatar
    Join Date
    03-21-2008
    Location
    Bakersfield, CA
    MS-Off Ver
    2010
    Posts
    19,226

    Re: Cut, Paste to other Sheet, Delete Macro

    For your insert row, this should do it:
    Sub InsertRow()
    '
    ' InsertRow Macro
    ' Keyboard Shortcut: Ctrl+Shift+I
    '
        Sheets("Macro Sheet").Range("A18:U18").Copy _
            Sheets("Floor Plan").Range("F" & Rows.Count).End(xlUp).Offset(1, -5)
    
    End Sub
    _________________
    Microsoft MVP 2010 - Excel
    Visit: Jerry Beaucaire's Excel Files & Macros

    If you've been given good help, use the icon below to give reputation feedback, it is appreciated.
    Always put your code between code tags. [CODE] your code here [/CODE]

    “None of us is as good as all of us” - Ray Kroc
    “Actually, I *am* a rocket scientist.” - JB (little ones count!)

+ 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.2.0