Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Macro help
Awhile ago I had help with the below macro. I'm running it again, but I have
9 columns now. 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! "Bernie Deitrick" wrote: Then try the version below, which acts on column A... As far as choosing between Jeanne Doe and Doe JEANNE whichever is found first will be used. HTH, Bernie MS Excel MVP 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 Befo=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 "NeedExcelHelp07" wrote in message ... What I'm getting: PRIMARY SECONDARY ID NAME Software A Software B Software C Software d.... BZ0T23 Jeanne Doe X BZ0T23 Doe JEANNE X X BZ0T23 Doe JEANNE X Ok the above is what I'm getting after running the Macro. So I'm asking how to merge them to make it look like below: PRIMARY SECONDARY ID NAME Software A Software B Software C Software d.... BZ0T23 Jeanne Doe X X X X Other than this, the Macro works well. Thanks alot for the help. |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
Macro not showing in Tools/Macro/Macros yet show up when I goto VBA editor | Excel Programming | |||
Need syntax for RUNning a Word macro with an argument, called from an Excel macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |