+ Reply to Thread
Results 1 to 5 of 5

Macro to CUT & Paste a row to another sheet if "Active" appears in Column J

Hybrid View

Fferjay Macro to CUT & Paste a row to... 12-16-2011, 03:33 PM
Steffen Thomsen Re: Macro to CUT & Paste a... 12-16-2011, 04:12 PM
Fferjay Re: Macro to CUT & Paste a... 12-20-2011, 09:21 AM
arlu1201 Re: Macro to CUT & Paste a... 12-20-2011, 12:09 PM
Steffen Thomsen Re: Macro to CUT & Paste a... 12-20-2011, 12:25 PM
  1. #1
    Registered User
    Join Date
    08-31-2011
    Location
    Albany,NY
    MS-Off Ver
    Excel 2007
    Posts
    9

    Macro to CUT & Paste a row to another sheet if "Active" appears in Column J

    I have a data set of 500 rows with 11 columns of data but more rows will conatantly be added. I need a MACRO to look at the value in Column J and if that value is "Active" then I need to cut and paste that row into another sheet called "Active" in the first empty row. This MACRO will need be assigned to a button and run whenever the button is pressed.

  2. #2
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Macro to CUT & Paste a row to another sheet if "Active" appears in Column J

    Try this

    Sub steffen
    On error resume next
    Do
    Sheets(1).Columns(10).Find("Active",,xlValues,xlWhole).EntireRow.Cut Destination:=Sheets("Active").Range("A60000").End(xlUp).Offset(1,0)
    Loop until err.number <> 0
    End sub
    Please take time to read the forum rules

  3. #3
    Registered User
    Join Date
    08-31-2011
    Location
    Albany,NY
    MS-Off Ver
    Excel 2007
    Posts
    9

    Re: Macro to CUT & Paste a row to another sheet if "Active" appears in Column J

    Quote Originally Posted by Steffen Thomsen View Post
    Try this

    Sub steffen
    On error resume next
    Do
    Sheets(1).Columns(10).Find("Active",,xlValues,xlWhole).EntireRow.Cut Destination:=Sheets("Active").Range("A60000").End(xlUp).Offset(1,0)
    Loop until err.number <> 0
    End sub
    Would I change the 1 by SHeets to the name of the first spreadsheet?

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

    Re: Macro to CUT & Paste a row to another sheet if "Active" appears in Column J

    If the sheet is named 1 and it is not the first sheet in the workbook, you can change the line to
     sheets("1")
    . However, if it is the first sheet in the workbook, you can leave it as it is.
    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]

  5. #5
    Valued Forum Contributor Steffen Thomsen's Avatar
    Join Date
    10-15-2010
    Location
    Kolding, Denmark
    MS-Off Ver
    Excel 2007 and Excel 2010
    Posts
    953

    Re: Macro to CUT & Paste a row to another sheet if "Active" appears in Column J

    you dont need to cahge anything if it's the first sheet you're running the macro on.

    Alternatly you can write it like this

    Sheets("your sheet name")

+ 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