Forum Discussion

rwagner34's avatar
rwagner34
Copper Contributor
Mar 15, 2021

Update data when new data is entered in a rage of cells

Is there a way to update data on a different sheet (like a dashboard) only when new data is entered in a different sheet - and only display the new data.  For example in sheet 2 I have a row of names and then a new dollar amount is entered next to their name, on sheet 1 I only want to display their name and the dollar amount when the dollar amount is updated.  Only one will update at a time so I only want to display one name and dollar amount at a time when it updates on sheet 2.  

Thanks.

6 Replies

  • mtarler's avatar
    mtarler
    Silver Contributor

    rwagner34  This can be done using a macro:

    Private Sub Worksheet_Change(ByVal Target As Range)
    Dim dashUpdate As Range
    Set dashUpdate = ThisWorkbook.Sheets("Dashboard sheet").Range("5:5")
        If Intersect(Target, Range("G:G")) Is Nothing Then
        Else
            Target.EntireRow.Copy dashUpdate
        End If
    
    End Sub

    This macro must be on the sheet object where the data will be updated

    "Dashboard sheet" needs to be the name of the sheet where the row will be copied to 

    and change "5:5" to the row where you want that row copied to

    and change "G:G" to the column that matches the column with dollars that if updated you want copied.

     

     

    • rwagner34's avatar
      rwagner34
      Copper Contributor

      mtarler 

      Thank you!

      I am getting an error from the first line - below.  I did update the other data, should "Worksheet_Change" be something else?  Under the screen shot is the Marco.  

       

      Private Sub Worksheet_Change(ByVal Target As Range)
      Dim dashUpdate As Range
      Set dashUpdate = ThisWorkbook.Sheets("Dashboard").Range("$A$6")
      If Intersect(Target, Range("$B$4:$B$101")) Is Nothing Then
      Else
      Target.EntireRow.Copy dashUpdate
      End If

      End Sub

       

      • mtarler's avatar
        mtarler
        Silver Contributor

        rwagner34 so in the VBA editor you need to open the code page for the specific Sheet.  And then in that window select Worksheet from the left drop down and the right will likely auto populate with SelectionChange but otherwise select that:

        If you pasted that Sub into workbook or a module or something, yeah it won't understand.

Resources