+ Reply to Thread
Results 1 to 5 of 5

How do I make values in a cell in one worksheet move to another worksheet

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    03-16-2013
    Location
    Florida
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    132

    How do I make values in a cell in one worksheet move to another worksheet

    Hello Arlu,

    You helped me sometime back. I'm trying to replicate what you showed me in a new workbook but can not get it to perform as before.

    I'm trying to move specific cell to another sheet if the cell has a value.

    I will attach the workbook

    I need to have rows moved to Task Summary sheet if column B has a value and need only Column A,B,C,H,M and only applies to rows B24:B40

    Here is the code I tried to do copying what you had done before
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim lastrow As Long
    
    If Not Intersect(Target, Range("B24:B40")) Is Nothing Then
        If Range("B" & Target.Row).Value <> "0" And Range("B" & Target.Row).Value <> "" Then
            lastrow = Worksheets("Task Summary").Range("A" & Rows.Count).End(xlUp).Row
            Range("A" & Target.Row & ":B" & Target.Row).Copy
            Worksheets("Task Summary").Range("A" & lastrow + 1).PasteSpecial (xlPasteValues)
            Range("C" & Target.Row & ":C" & Target.Row).Copy
            Worksheets("Task Summary").Range("C" & lastrow + 1).PasteSpecial (xlPasteValues)
            Range("H" & Target.Row & ":H" & Target.Row).Copy
            Worksheets("Task Summary").Range("D" & lastrow + 1).PasteSpecial (xlPasteValues)
        End If
    End If
    End Sub

    Here is code you had made for me that I used to get the above code
    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim lastrow As Long
    
    If Not Intersect(Target, Range("C90:C403")) Is Nothing Then
        If Range("C" & Target.Row).Value <> "0" And Range("C" & Target.Row).Value <> "" Then
            lastrow = Worksheets("Task Summary").Range("A" & Rows.Count).End(xlUp).Row
            Range("A" & Target.Row & ":C" & Target.Row).Copy
            Worksheets("Task Summary").Range("A" & lastrow + 1).PasteSpecial (xlPasteValues)
            Range("E" & Target.Row & ":E" & Target.Row).Copy
            Worksheets("Task Summary").Range("D" & lastrow + 1).PasteSpecial (xlPasteValues)
            Range("G" & Target.Row & ":G" & Target.Row).Copy
            Worksheets("Task Summary").Range("E" & lastrow + 1).PasteSpecial (xlPasteValues)
            Range("I" & Target.Row & ":I" & Target.Row).Copy
            Worksheets("Task Summary").Range("F" & lastrow + 1).PasteSpecial (xlPasteValues)
        End If
    End If
    End Sub

    When I paste code into into editor as is nothing happens

    ThanksExample MBBW.xlsx
    Last edited by icevinson; 07-11-2013 at 12:18 PM.

  2. #2
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: How do I make values in a cell in one worksheet move to another worksheet

    Hi, icevinson,

    there is not data in the range of B24 tro B40 which could trigger any code as well as the value of the cells is set to 0 (code gets triggered but will not copy). Please mind that there may only be one procedure with this name behind any sheet. To match with the sample sheet I adjusted the range:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim LastRow As Long
    
    If Not Intersect(Target, Range("B2:B18")) Is Nothing Then
        If Range("B" & Target.Row).Value <> "0" And Range("B" & Target.Row).Value <> "" Then
            With Worksheets("Task Summary")
                LastRow = .Range("A" & Rows.Count).End(xlUp).Row
                .Range("A" & LastRow + 1).Resize(1, 3).Value = Range("A" & Target.Row).Resize(1, 3).Value
                .Range("D" & LastRow + 1).Value = Range("H" & Target.Row)
                .Range("E" & LastRow + 1).Value = Range("M" & Target.Row)
            End With
        End If
    End If
    End Sub
    Ciao,
    Holger
    Use Code-Tags for showing your code: [code] Your Code here [/code]
    Please mark your question Solved if there has been offered a solution that works fine for you

  3. #3
    Forum Contributor
    Join Date
    03-16-2013
    Location
    Florida
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    132

    Re: How do I make values in a cell in one worksheet move to another worksheet

    Thanks Holger,

    So I have pasted the code you gave me into the editor for the worksheet I'm working on and enter values into the cells I need to have moved but it does not move them to the Task Summary page

    Am I missing a step?

    And just a note I sent just a sample of page which is why there was no data on the real page I need it to be B24 trough B40 I did adjust that before I added to editor

    Thanks for your help

    Also I need it to triger the move if there is a value in cell greater then 0 it could be 1, 67, 84 etc if there is a value placed in cell it needs to move
    Last edited by icevinson; 07-11-2013 at 01:37 PM.

  4. #4
    Forum Guru HaHoBe's Avatar
    Join Date
    02-19-2005
    Location
    Hamburg, Germany
    MS-Off Ver
    work: 2016 on Win10 (notebook), private: 365 on Win11 (desktop), 2019 on Win11 (notebook)
    Posts
    8,198

    Re: How do I make values in a cell in one worksheet move to another worksheet

    Hi, icevinson,

    the value in Column B in the given range needs to be different to Zero and canīt be empty.

    Please have a look at my sample and see if that works for you.

    Ciao,
    Holger
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    03-16-2013
    Location
    Florida
    MS-Off Ver
    Excel 2011 for Mac
    Posts
    132

    Re: How do I make values in a cell in one worksheet move to another worksheet

    Perfect... thanks so much for the help

+ 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