M
MCheru
Here is the code I currently have.
Sub CPSCount()
Columns("B:C").Select
Selection.Copy
Sheets.Add
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "Sheet3"
Range("A1").Select
ActiveSheet.Paste
Rows("1:1").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Range("C1").Select
ActiveCell.FormulaR1C1 = "MP11"
Range("D1").Select
ActiveCell.FormulaR1C1 = "MP12"
Range("E1").Select
ActiveCell.FormulaR1C1 = "MP20"
This is what my code currently does…
Sheet 1 copy columns B:C
Insert new worksheet (Sheet3)
Paste contents into new worksheet (Sheet3) starting in cell A1
Insert row above Row 1
In cell C1 type MP11, in cell D1 type MP12, and in cell E1 type MP20
These are the additional steps I would like my code to take…
Every cell in Column B has either MP11, MP12, or MP20, while every cell in
Column A has a 7 digit number, so the contents of Column A and Column B
belong together.
I want to keep a tally/count of how many times each seven digit number
appears in MP11, MP12, and MP20. In other words, I want to create a code
that will look at the number in Column A then look for MP11, MP12, or MP20 in
Column B. If Column B says MP11 then increase Column C by 1 in the same row,
if Column B says MP12 then increase Column D by 1 in the same row, if Column
B says MP20 then increase Column E by 1 in the same row. Sometimes the seven
digit number in Column A will be repeated. When that happens I want to
delete the row where the duplicate(s) appear(s) but increase the count in
Column C, D, or E (depending on the contents in Column B) by 1.
Sub CPSCount()
Columns("B:C").Select
Selection.Copy
Sheets.Add
Sheets("Sheet3").Select
Sheets("Sheet3").Name = "Sheet3"
Range("A1").Select
ActiveSheet.Paste
Rows("1:1").Select
Application.CutCopyMode = False
Selection.Insert Shift:=xlDown
Range("C1").Select
ActiveCell.FormulaR1C1 = "MP11"
Range("D1").Select
ActiveCell.FormulaR1C1 = "MP12"
Range("E1").Select
ActiveCell.FormulaR1C1 = "MP20"
This is what my code currently does…
Sheet 1 copy columns B:C
Insert new worksheet (Sheet3)
Paste contents into new worksheet (Sheet3) starting in cell A1
Insert row above Row 1
In cell C1 type MP11, in cell D1 type MP12, and in cell E1 type MP20
These are the additional steps I would like my code to take…
Every cell in Column B has either MP11, MP12, or MP20, while every cell in
Column A has a 7 digit number, so the contents of Column A and Column B
belong together.
I want to keep a tally/count of how many times each seven digit number
appears in MP11, MP12, and MP20. In other words, I want to create a code
that will look at the number in Column A then look for MP11, MP12, or MP20 in
Column B. If Column B says MP11 then increase Column C by 1 in the same row,
if Column B says MP12 then increase Column D by 1 in the same row, if Column
B says MP20 then increase Column E by 1 in the same row. Sometimes the seven
digit number in Column A will be repeated. When that happens I want to
delete the row where the duplicate(s) appear(s) but increase the count in
Column C, D, or E (depending on the contents in Column B) by 1.