Excel Delete from column A - delete from all other worksheets

If I have data in column A of the "master" sheet and I delete it, I want to be able to delete the related data in all worksheets in the workbook.  The other worksheets would have the data in column A (matching what what is column A of the master).  I need to delete column A and B in the other sheets.  I don't want to delete the whole row, just the data.

How can I do this with VBA?

See attached file.  Please update attached with your code.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Saurabh Singh TeotiaCommented:
I'm assuming this is what you are looking for..this code will go into sheet module of master..

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Me.Range("A:A")) Is Nothing Then Exit Sub

End Sub

Open in new window

And this will go into new module...

Sub deletedata()
    Dim ws As Worksheet, rng As Range, cell As Range, r As Range
    Dim lrow As Long, lrow1 As Long, r1 As Range
    Dim ws1 As Worksheet

    Set ws1 = Sheets("MASTER")

    lrow = ws1.Cells(Cells.Rows.Count, "A").End(xlUp).Row

    Set rng = Range("A2:A" & lrow)

    For Each ws In ThisWorkbook.Worksheets
        If ws.Name <> ws1.Name Then
            lrow1 = ws.Cells(Cells.Rows.Count, "A").End(xlUp).Row
            Set r = ws.Range("A2:A" & lrow1)

            For Each cell In r

                If Application.WorksheetFunction.CountIf(rng, cell.Value) = 0 Then

                    If r1 Is Nothing Then
                        Set r1 = cell
                        Set r1 = Union(r1, cell)
                    End If

                End If

            Next cell

            If Not r1 Is Nothing Then r1.EntireRow.Delete
            Set r1 = Nothing

        End If

    Next ws

End Sub

Open in new window

Enclosed is working example for your reference.. what this will do as soon you delete a value in A Column of master that row will be deleted from all your worksheets..automatically...

maverick0728Author Commented:
I am getting strange results when my data doesn't always start in row 2.  Sometimes the headers are deleted.  See the example attached.
Saurabh Singh TeotiaCommented:
So if i understand correctly you are saying for each worksheet data or header rows not necessarily at row-2?? If that's the case can you help me understand the logic why do you move headers?? And can i use headers value like item or static as value to find header row??
Amazon Web Services

Are you thinking about creating an Amazon Web Services account for your business? Not sure where to start? In this course you’ll get an overview of the history of AWS and take a tour of their user interface.

maverick0728Author Commented:
Each worksheet may be different with a starting point for the headers.  This is for an estimate.  Each worksheet is for a specific workcenter and there are some reference values in the top rows for each worksheet.  Most start at row 2, 5 or row 22, but it can be dynamic.  
You can use the value "item" to find the header row.
Thanks for your help.
Saurabh Singh TeotiaCommented:
Their you go enclosed your workbook for your reference where i did the necessary changes...

maverick0728Author Commented:
This looks like its working, the issue though is that we don't want to delete the entire row.  How can I just delete the data in column A and B on the other sheets?
Saurabh Singh TeotiaCommented:
Quick question when you say delete you want to delete cells A and B and move the cell which are below to up or you just want to clear the A and B Cell?? Which one you want to do??
maverick0728Author Commented:
just clear the A and B cell
Saurabh Singh TeotiaCommented:
Use this version...


Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
maverick0728Author Commented:
It works perfectly.  Thanks.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Excel

From novice to tech pro — start learning today.