Import Most Recently updated rows


New Member
Nov 20, 2017
Hi All,

I have a SOURCE workbook I use for Order Management and when I submit the form data to the sheet, it also submits it to a closed, HUB workbook on a shared drive. There are 6 other people using this. The HUB workbook has everyone's work. When you open the SOURCE workbook it will ask you if you would like to import data from HUB. The idea is that it will only import rows that have new data. Currently, when this is launched it imports all the rows, then removes the duplicates. It's messy, slow, and i don't think it is importing the most recent data. The last column of these sheets display a time stamp on each row (Last Modified).

My Question:

Is there a way to import the data from the HUB to the SOURCE so everyone has the most up to date information? Below is the code i'm using to do the import. Any help or guidance would be greatly appreciated. Thank you!

 Dim wbHub As Workbook, wsOrderStatus As Worksheet
    Dim CopyFromRange As Range, CopyToRange As Range
    Dim NextRow As Long
    Const wsPassword As String = "2885"
    'On Error GoTo exitsub
    Set wsOrderStatus = ThisWorkbook.Sheets("Order Status")
    If Not Dir(fileName, vbDirectory) = vbNullString Then
    Application.ScreenUpdating = False
    With wsOrderStatus
        .Unprotect Password:=wsPassword
        If .FilterMode Then .ShowAllData
        NextRow = .Cells(.Rows.Count, "A").End(xlUp).Row + 1
        Set CopyToRange = .Cells(NextRow, 1)
    End With
    Set wbHub = Application.Workbooks.Open(fileName, ReadOnly:=False, Password:=wbPassword)
    With wbHub.Sheets(1).UsedRange
        Set CopyFromRange = .Offset(1, 0).Resize(.Rows.Count - 1)
    End With
    CopyFromRange.Copy CopyToRange
    wbHub.Close False
     Err.Raise 53
    End If
    Set wbHub = Nothing
    If Not wbHub Is Nothing Then wbHub.Close False
    wsOrderStatus.Protect Password:=wsPassword, Contents:=True, _
                          AllowFiltering:=True, Userinterfaceonly:=True
    Application.ScreenUpdating = True
    If Err > 0 Then MsgBox (Error(Err)), 64, "Error"
End Sub


New Member
Nov 20, 2017
Thanks for the quick reply, I had oringsally thought of doing that but the form doesn't open up on Excel Online with the share point. When the SOURCE Data is sent to the HUB workbook, it does over ride the existing data, I guess when importing back to SOURCE from HUB, i could delete all the data and therefore only be left with the new DATA.

Forum statistics

Latest member

Some videos you may like

This Week's Hot Topics

  • populate from drop list with multiple tables
    Hi All, i have a drop list that displays data, what i want is when i select one of those from the list to populate text from different tables on...
  • Find list of words from sheet2 in sheet1 before a comma and extract text vba
    Hi Friends, Trying to find the solution on my task. But did not find suitable one to the need. Here is my query and sample file with details...
  • Dynamic Formula entry - VBA code sought
    Hello, really hope one of you experts can help with this - i've spent hours on this and getting no-where. .I have a set of data (more rows than...
  • Listbox Header
    Have a named range called "AccidentsHeader" Within my code I have: [CODE]Private Sub CommandButton1_Click() ListBox1.RowSource =...
  • Complex Heat Map using conditional formatting
    Good day excel world. I have a concern. Below link have a list of countries that carries each country unique data. [URL...
  • Conditional formatting
    Hi good morning, hope you can help me please, I have cells P4:P54 and if this cell is equal to 1 then i want row O to say "Fully Utilised" and to...