+ Reply to Thread
Results 1 to 5 of 5

Check if data in first 3 columns are identical in 3 different sheets?

  1. #1
    Registered User
    Join Date
    11-05-2012
    Location
    Zutphen
    MS-Off Ver
    Excel 2003
    Posts
    56

    Check if data in first 3 columns are identical in 3 different sheets?

    Hello guys , you have helped me in the past !

    I hope there is someone out there who knows how to do this...

    Basicly what Im looking for is a macro which check if the first 3 columns . A-B-C are identical otherwise give a message box which says something like Error: not all the sheets are identical. This macro should work from the moment you start it.. until the moment you shut it down.

    Or other solution ,
    If someone enters tries to enter something or change something in the first 3 columns in all sheets .. all sheets should be CTRL clicked. So it does it to all the sheets. ( always stays identical)

    I hope someone knows a solution.

    Yours , Steven

  2. #2
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Check if data in first 3 columns are identical in 3 different sheets?

    On each sheet:

    Private Sub Worksheet_Change(ByVal Target As Range)

    If Not VBAAdding Then
    If Target.Column >= 1 Or Target.Column <= 3 Then
    PASS_TO_OTHERS ActiveSheet, Target.Address, Target.value
    End If
    End If
    End Sub

    In a module

    Public VBAAdding As Boolean

    Public Sub PASS_TO_OTHERS(wsPassed As Excel.Worksheet, strAddress As String, valPassed As String)

    VBAAdding = True

    For Each ws In ActiveWorkbook.Worksheets

    If ws.Name <> wsPassed.Name Then

    ws.Range(strAddress).value = valPassed

    End If

    Next ws

    VBAAdding = False

    End Sub


    If you wanted a super dooper solution, you could look at event sinking and sink the worksheet change for all.

  3. #3
    Valued Forum Contributor
    Join Date
    09-21-2011
    Location
    Birmingham UK
    MS-Off Ver
    Excel 2003/7/10
    Posts
    2,188

    Re: Check if data in first 3 columns are identical in 3 different sheets?

    Here is what i've done
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    11-05-2012
    Location
    Zutphen
    MS-Off Ver
    Excel 2003
    Posts
    56

    Re: Check if data in first 3 columns are identical in 3 different sheets?

    Thanks for the help! sorry for the late response

    When i check the file you sent . If add a value in colums 4 and 5 it also copies to the other sheets... this is not what i would like to happen. How can i fix this? I want this ! this looks good only now for the first 3 columns and !

    Also should i change something here?
    Please Login or Register  to view this content.
    Yours , Steven

  5. #5
    Registered User
    Join Date
    11-05-2012
    Location
    Zutphen
    MS-Off Ver
    Excel 2003
    Posts
    56

    Re: Check if data in first 3 columns are identical in 3 different sheets?

    HELP ! needed , it works for whole sheet and not just 3 colums.. it was an xlsm ... I use .xls so Excel 2003 is this the reason it does not work?

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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