Results 1 to 17 of 17

Move and delete rows

Threaded View

  1. #1
    Registered User
    Join Date
    09-21-2009
    Location
    Boston, Ma
    MS-Off Ver
    Excel 2003
    Posts
    9

    Move and delete rows

    Hi,

    I am trying to create a macro the looks at column A and moves the entire row to another worksheet or deletes the entire row based off of the value in each cell. Right now I have the Macro replace the downloaded values to either AG, G, GI, ICP, IMG or delete. The idea be to move all of the values with AG in column A to the AG worksheet, move G to the G worksheet, etc.. and then delete all of those with delete in the cell. This is what I have so far, could someone help me to create this???

    Sub Reformat_macro()
    '
    ' Reformat_macro Macro
    ' Macro recorded 9/21/2009 by rcoates
    '
    ' Keyboard Shortcut: Ctrl+Shift+M
    '
        Columns("A:A").Select
        Selection.Delete Shift:=xlToLeft
        Rows("1:1").Select
        Selection.Delete Shift:=xlUp
        Columns("B:B").Select
        Selection.Delete Shift:=xlToLeft
        Range("C:C,D:D,I:I,J:J").Select
        Range("J1").Activate
        ActiveWindow.ScrollColumn = 2
        ActiveWindow.ScrollColumn = 3
        ActiveWindow.ScrollColumn = 4
        ActiveWindow.ScrollColumn = 5
        ActiveWindow.ScrollColumn = 6
        Range("C:C,D:D,I:I,J:J,K:K,L:L,M:M,N:N").Select
        Range("N1").Activate
        Selection.Delete Shift:=xlToLeft
        ActiveWindow.ScrollColumn = 5
        ActiveWindow.ScrollColumn = 4
        ActiveWindow.ScrollColumn = 3
        ActiveWindow.ScrollColumn = 2
        ActiveWindow.ScrollColumn = 1
        Cells.Select
        Selection.Replace What:="9999428", Replacement:="cash_usd", LookAt:= _
            xlPart, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="3390-2261", Replacement:="ICP", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="3243-9703", Replacement:="Delete", LookAt:= _
            xlPart, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="1208-2340", Replacement:="IMG", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="1623-2668", Replacement:="Delete", LookAt:= _
            xlPart, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="7461-9011", Replacement:="Delete", LookAt:= _
            xlPart, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="5838-6867", Replacement:="Delete", LookAt:= _
            xlPart, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="7103-2902", Replacement:="Delete", LookAt:= _
            xlPart, SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="7122-7716", Replacement:="GI", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="4125-7242", Replacement:="G", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
        Selection.Replace What:="4810-6156", Replacement:="AG", LookAt:=xlPart, _
            SearchOrder:=xlByRows, MatchCase:=True, SearchFormat:=False, _
            ReplaceFormat:=False
    End Sub
    Last edited by Ross86; 09-21-2009 at 03:16 PM.

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