Help with a Macro

N

NeedExcelHelp07

Below is a Macro I'm using. How can I modify this macro so that the data in
column c that
is in Sheet B but not in sheet A is displayed? I still need the rest of the
functions of the macro to work.

Example of what is happening:
In Sheet A:
ID NAME Location

ABCDK2 Hank Doe

In Sheet B
ID NAME Location
ABCDK2 Hank Doe California

When I run the macro, California is not being displayed in the Summary,that
field is blank because in Sheet A, it is blank and that is what is read first.

Thanks!



Sub MakeSummarySheetV3()
Dim mySht As Worksheet
Dim mySumSheet As Worksheet
Dim myCell As Range
Dim myDest As Range
Dim myRow As Long

On Error Resume Next
Application.DisplayAlerts = False
Worksheets("Summary").Delete
Application.DisplayAlerts = True

ActiveSheet.Copy Before:=Sheets(1)
Set mySumSheet = ActiveSheet
mySumSheet.Name = "Summary"

For Each mySht In ActiveWorkbook.Worksheets
If mySht.Name = "Summary" Then GoTo SkipMe:
Set myDest = mySumSheet.Cells(1, 256).End(xlToLeft)(1, 2)
myDest.Value = mySht.Name
Set myDest = myDest.EntireColumn

For Each myCell In mySht.Range("A1").CurrentRegion.Columns(1).Cells
If myCell.Row <> 1 Then
If Not IsError(Application.Match(myCell.Value, _
mySumSheet.Range("A:A"), False)) Then
myDest.Cells(Application.Match(myCell.Value, _
mySumSheet.Range("A:A"), False)).Value = "X"
Else
myRow = mySumSheet.Cells(Rows.Count, 1).End(xlUp)(2).Row
mySumSheet.Cells(myRow, 1).Value = myCell.Value
mySumSheet.Cells(myRow, 2).Value = myCell.Offset(0, 1).Value
mySumSheet.Cells(myRow, 3).Value = myCell.Offset(0, 2).Value
myDest.Cells(myRow).Value = "X"
End If
End If
Next myCell
SkipMe:
Next mySht

End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top