+ Reply to Thread
Results 1 to 2 of 2

Auto update cell from one sheet to another(or workbook) with conditions

  1. #1
    Registered User
    Join Date
    06-12-2022
    Location
    Philippines, NCR
    MS-Off Ver
    2016
    Posts
    2

    Auto update cell from one sheet to another(or workbook) with conditions

    Hello Excel Forum,

    If I could reach for some help from anyone with my below VBA. [new to VBA 🙂]

    Changes are expected to be made in Columns: DEFG.
    RE: From Attachments

    [Sub test()
    Dim a, i As Long, dic As Object

    Application.ScreenUpdating = False

    Set dic = CreateObject("Scripting.Dictionary")
    'sheet1 as the datasource that will be used to reflect changes to sheet2
    a = Sheets("sheet1").Cells(1).CurrentRegion.Columns(1).Value

    For i = 2 To UBound(a, 1)
    dic(a(i, 1)) = i

    Next
    'sheet2 as the destination that will be used to reflect changes from sheet1
    With Sheets("sheet2")
    a = .Cells(1).CurrentRegion.Columns(1).Value
    For i = 2 To UBound(a, 1)
    If dic.exists(a(i, 1)) Then
    Sheets("sheet1").Rows(dic(a(i, 1))).Copy .Rows(i)
    dic.Remove a(i, 1)
    End If
    Next
    If dic.Count Then
    For i = 0 To dic.Count - 1
    Sheets("sheet1").Rows(dic.items()(i)).Copy _
    Destination:=.Range("a" & Rows.Count).End(xlUp)(2)
    Next
    End If
    End With
    Application.ScreenUpdating = True
    End Sub
    ]
    Attached Files Attached Files
    Last edited by lbugay; 06-13-2022 at 04:00 AM.

  2. #2
    Registered User
    Join Date
    06-12-2022
    Location
    Philippines, NCR
    MS-Off Ver
    2016
    Posts
    2

    Re: Auto update cell from one sheet to another(or workbook) with conditions

    Attachments
    Attached Files Attached Files

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. VBA to compare and update data on Master Sheet/workbook from another Sheet/workbook
    By Lee_of_Excel in forum Excel Programming / VBA / Macros
    Replies: 25
    Last Post: 08-12-2020, 08:19 AM
  2. Using excel workbook to update access database on conditions
    By swade730 in forum Access Tables & Databases
    Replies: 5
    Last Post: 02-23-2016, 09:53 AM
  3. Replies: 4
    Last Post: 02-06-2016, 12:51 PM
  4. Auto serial numbers across multiple work sheet in a workbook in a particular cell
    By subhassamuel in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-19-2013, 05:43 AM
  5. Replies: 1
    Last Post: 07-24-2013, 11:51 AM
  6. [SOLVED] Auto update cell for given date range in next sheet
    By yogananda.muthaiah in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2012, 05:07 AM
  7. Auto Update from Different Workbook Help
    By bbarrene in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 03-17-2010, 11:52 AM

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