Results 1 to 3 of 3

Need help with a macro to move row to another worksheet

Threaded View

  1. #1
    Registered User
    Join Date
    04-05-2011
    Location
    US, Ohio
    MS-Off Ver
    Excel 2003
    Posts
    2

    Need help with a macro to move row to another worksheet

    I need help with a macro to move rows to different worksheets. For example, If I put in Delivered, I want the row moved to a "Delivered" worksheet. If I put in Declined, I want the row moved to a "Declined" worksheet. I have been able to successfully get one of these to work at a time, but I need both of these to work in a single Macro. Help anyone? Here's the code I used to move one of them.


    Option Explicit
    Dim Flag As Boolean
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim LR As Long
    LR = Range("A" & Rows.Count).End(xlUp).Row

    If Flag = True Then Exit Sub
    If Not Intersect(Target, Range("B2:B100" & LR)) Is Nothing Then
    If Target.Value = "Delivered" Then

    LR = Sheets("DELIVERED").Range("A" & Rows.Count).End(xlUp).Row + 1
    Target.EntireRow.Copy
    Sheets("DELIVERED").Range("A" & LR).PasteSpecial
    Flag = True
    Target.EntireRow.Delete
    End If
    End If
    Application.CutCopyMode = False
    Flag = False
    End Sub

    /close
    Last edited by dojilee; 04-06-2011 at 04:57 PM.

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