M
MCheru
I have a worksheet and Columns A:C have contents in them. The contents in
every row belong together. So A1, B1, and C1 belong together, A2, B2, and C2
belong together and so on.
Every cell in Column A typically has between 10 and 15 characters.
Every cell in Column B has between 30 and 35 characters.
Every cell in Column C has 1 number in it which could be one or two digits.
I’d like to create a macro that will search column A:B. Every time a
character is repeated in Column A:B, I want to delete that row but take the
number in Column C that is associated to the row that was deleted and add it
to the quantity in Column C of the original character in Column A:B that was
identical but did not get deleted.
I pasted the code I currently have, but its not really doing the job. Might
you help me?
Sub MCThree
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R35C3").CreatePivotTable TableDestination:= _
"'[Sheet 2]Sheet1'!R1C5",
TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
With ActiveSheet.PivotTables("PivotTable1").PivotFields("a")
..Orientation = xlRowField
..Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("b")
..Orientation = xlRowField
..Position = 2
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField
ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("c"), "Sum of c", xlSum
ActiveWorkbook.ShowPivotTableFieldList = False
End Sub
every row belong together. So A1, B1, and C1 belong together, A2, B2, and C2
belong together and so on.
Every cell in Column A typically has between 10 and 15 characters.
Every cell in Column B has between 30 and 35 characters.
Every cell in Column C has 1 number in it which could be one or two digits.
I’d like to create a macro that will search column A:B. Every time a
character is repeated in Column A:B, I want to delete that row but take the
number in Column C that is associated to the row that was deleted and add it
to the quantity in Column C of the original character in Column A:B that was
identical but did not get deleted.
I pasted the code I currently have, but its not really doing the job. Might
you help me?
Sub MCThree
ActiveWorkbook.PivotCaches.Add(SourceType:=xlDatabase, SourceData:= _
"Sheet1!R1C1:R35C3").CreatePivotTable TableDestination:= _
"'[Sheet 2]Sheet1'!R1C5",
TableName:= _
"PivotTable1", DefaultVersion:=xlPivotTableVersion10
With ActiveSheet.PivotTables("PivotTable1").PivotFields("a")
..Orientation = xlRowField
..Position = 1
End With
With ActiveSheet.PivotTables("PivotTable1").PivotFields("b")
..Orientation = xlRowField
..Position = 2
End With
ActiveSheet.PivotTables("PivotTable1").AddDataField
ActiveSheet.PivotTables( _
"PivotTable1").PivotFields("c"), "Sum of c", xlSum
ActiveWorkbook.ShowPivotTableFieldList = False
End Sub