+ Reply to Thread
Results 1 to 4 of 4

Rows over-typing previous rows of data when automatically being moved using vba coding

  1. #1
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Rows over-typing previous rows of data when automatically being moved using vba coding

    Hi,

    I can not get the following code towork correctly as when the rows of data are moved automatically to it's new sheet the rows are over-typing the previous rows. Can someone point me in the right direct when I have gone wrong.


    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("F3:F" & LR)) Is Nothing Then
    If Target.Value = "Contract signed & received" Then

    LR = Sheets("New Clients").Range("A" & Rows.Count).End(xlUp).Row + 1
    Target.EntireRow.Copy
    Sheets("New Clients").Range("A" & LR).PasteSpecial
    Flag = True
    Target.EntireRow.Delete

    ElseIf Target.Value = "Business Lost" Then

    LR = Sheets("Lost Business").Range("A" & Rows.Count).End(xlUp).Row + 1
    Target.EntireRow.Copy
    Sheets("Lost Business").Range("A" & LR).PasteSpecial
    Flag = True
    Target.EntireRow.Delete

    End If
    End If
    Application.CutCopyMode = False
    Flag = False
    End Sub

  2. #2
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Rows over-typing previous rows of data when automatically being moved using vba coding

    Hello Kaz09. Without seeing your file, try this code:
    Please Login or Register  to view this content.
    Last edited by Mumps1; 02-11-2013 at 11:56 AM.

  3. #3
    Registered User
    Join Date
    10-25-2012
    Location
    Northamptonshire
    MS-Off Ver
    Excel 2010
    Posts
    54

    Re: Rows over-typing previous rows of data when automatically being moved using vba coding

    WOW, thanks Mumps1, I was getting very stressed as I couldn't see what to do and you have made it so easy. Using your coding I have even been able to add new sheets to transfer data to based on the drop down list in column 'F' . Many thanks for your time and effort and making my life so much easier at work

    Thanks again Kaz09

  4. #4
    Forum Expert Mumps1's Avatar
    Join Date
    10-10-2012
    Location
    Toronto, Canada
    MS-Off Ver
    Excel 2010, 365
    Posts
    8,026

    Re: Rows over-typing previous rows of data when automatically being moved using vba coding

    It was my pleasure.

+ 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