+ Reply to Thread
Results 1 to 3 of 3

Thread: Autoupdate rows in one sheet with data from another

  1. #1
    Registered User
    Join Date
    01-07-2011
    Location
    Stamford, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Exclamation Autoupdate rows in one sheet with data from another

    I was wondering if it is possible to automatically add a row of information to one tab after it has been added to a different tab?
    For instance i have been copying and pasting a single row from multiple spreadsheets into a tab on a master one. The next tab is linked to the first, with information pulled out from each row (the same data each time).
    Other people will be updating the first tab with further rows and i want the second tab to recognise that data has been added to the first tab and update itself accordingly. (So i don't have to go into the tab, hightlight a row and use autofill each time).
    Last edited by Riosmitham; 01-12-2011 at 05:52 AM.

  2. #2
    Forum Guru Palmetto's Avatar
    Join Date
    04-04-2007
    Location
    South Eastern, USA
    MS-Off Ver
    XP, 2007
    Posts
    3,523

    Re: Autoupdate rows in one sheet with data from another

    Lacking the specific about the worksheets, here is the basic code to get you started.

    Option Explicit
    
    Private Sub Worksheet_Change(ByVal Target As Range)
    
        Dim nextrow As Long
        
        nextrow = Sheet2.Cells(Rows.Count, "A").End(xlUp).Row + 1
        
        If Target.Cells.Count > 1 Then Exit Sub
        
        Application.ScreenUpdating = False
        
        If Not Intersect(Target, Range("G1:G100")) Is Nothing Then
            Range(Cells(Target.Row, "A"), Cells(Target.Row, "G")).Copy Sheet2.Range("A" & nextrow)
        End If
        
        Application.CutCopyMode = False
        Application.ScreenUpdating = True
    
    End Sub
    This code uses sheet code names -- not worksheet (tab) names. You may need to revise the sheet code names and certainly the range references.

    The code works as follows:
    Column-G is the "last" entry column. When a cell in the range of G1:G100 is changed, the range of cells from A:G, for that row, are copied to Sheet2.

    This code must be placed in the module of the worksheet in which you are entering the data.

    How to add the code
    1. Right-click the sheet tab of the target sheet, choose View Code
    2. Copy and paste the code into the VB Editor
    3. Make any necessary changes to sheet and range references
    4. Close the VB Editor
    Palmetto

    Do you know . . . ?

    You can leave feedback and add to the reputation of all who contributed a helpful response to your solution by clicking the star icon located at the left in one of their post in this thread.

  3. #3
    Registered User
    Join Date
    01-07-2011
    Location
    Stamford, England
    MS-Off Ver
    Excel 2007
    Posts
    13

    Re: Autoupdate rows in one sheet with data from another

    Thanks for your help but this code won't work for me because i only want to select certain columns and reaarange them on the second sheet. To solve this i have simply autofilled for 1000 rows and they will update automatically, it just looks messy because i end up with loads of 0s and #VALUE!s. It's not a major issue though.

+ Reply to Thread

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.2.0