Consulting

Results 1 to 3 of 3

Thread: Solved: VBA that synchronize sheets to another sheet

  1. #1

    Solved: VBA that synchronize sheets to another sheet

    Hi all,
    I found on the Internet a VBA code that will synchronize a certain range (A1:A10,B1:B10) from sheet 1 within sheet 4. The code (In ThisWorkbook) works fine so far.

    Is it possible to change the VBA code that it on the same time also ranges (A1:A10,B1:B10) from sheet 2 and sheet 3 to be synchronized within sheet 4? Respectively for sheet 2 (A1:A10,B1:B10) synchronized within sheet 4 inrange ( A20:A30,B20:B30) and for sheet 3 synchronized within sheet 4 in range (A40:A50,B40:B50).

    More info and the basic VBA code are put in the example Test.

    Thank you very much in advance.
    Marc
    Attached Files Attached Files

  2. #2
    VBAX Regular
    Joined
    Nov 2011
    Location
    Ufa
    Posts
    75
    Location
    Hi Marc
    try it
    [vba]Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
    If Intersect(Target, Sh.Range("A1:A10,K1:K10")) Is Nothing Then Exit Sub
    Dim i As Long
    Select Case Sh.Name
    Case "Sheet1": i = 1
    Case "Sheet2": i = 21
    Case "Sheet3": i = 40
    Case Else: Exit Sub
    End Select
    With Application
    .EnableEvents = False
    Sh.Range("A1:A10,K1:K10").Copy Sheets("Sheet4").Cells(i, 1)
    .EnableEvents = True
    End With
    End Sub[/vba]
    Attached Files Attached Files

  3. #3
    That's excellent, it works perfectly! Thanks very much for taking the time to look at it nilem, you've made my day
    Marc

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •