Hey,
My first post sorry if being unclear,
I am complete newbie to VBA , I have a large workbook with multiple sheets. My goal is to have a macro that would Remove duplicate from Sheet (XXXX) from column A and Sum the respected value from column B as well as C.
So the data would have 3 columns that looks like this:
A B C
Name hrs units
Sam 2 1
Joe 1 4
Sam 2 3
Joe 1 1
A B C
Name hrs units
Sam 4 4
Joe 2 5
The problem with my code is that I cant have it SUM column C correctly but Column B works fine . Column C has some correct data but not fully as its miss matching the values in ( units) with ( name).
Here's the original code that works on 2 columns correctly but wont work 100% correctly on column C , I have alot of different macros running after this marco runs they are based on the having my data being in the same sheet and same offsets for columns. One thing worth mentioning that my data is being pulled from a url that the number of rows is changing every time the user decides to pull data but the column area a constant . All the help would be greatly appreciated. Thanks!
My first post sorry if being unclear,
I am complete newbie to VBA , I have a large workbook with multiple sheets. My goal is to have a macro that would Remove duplicate from Sheet (XXXX) from column A and Sum the respected value from column B as well as C.
So the data would have 3 columns that looks like this:
A B C
Name hrs units
Sam 2 1
Joe 1 4
Sam 2 3
Joe 1 1
A B C
Name hrs units
Sam 4 4
Joe 2 5
The problem with my code is that I cant have it SUM column C correctly but Column B works fine . Column C has some correct data but not fully as its miss matching the values in ( units) with ( name).
Here's the original code that works on 2 columns correctly but wont work 100% correctly on column C , I have alot of different macros running after this marco runs they are based on the having my data being in the same sheet and same offsets for columns. One thing worth mentioning that my data is being pulled from a url that the number of rows is changing every time the user decides to pull data but the column area a constant . All the help would be greatly appreciated. Thanks!
VBA Code:
Sub PPA()
With Worksheets("Induct") '
With .Range("A1:B3500").Resize(.Cells(.Rows.Count, 3).End(xlUp).Row)
.Copy
With .Offset(, .Columns.Count + 1)
.PasteSpecial xlPasteValues '
.Columns(2).Offset(1).Resize(.Rows.Count - 1, 1).FormulaR1C1 = "=SUMIF(C1,RC1,C[-" & .Columns.Count + 1 & "])"
.Value = .Value
.RemoveDuplicates 1, xlYes
.Columns(3).Offset(1).Resize(.Rows.Count - 1, 1).FormulaR1C1 = "=SUMIF(C1,RC1,C[-" & .Columns.Count + 1 & "])"
.Value = .Value
.RemoveDuplicates 1, xlYes
Sheets("Induct").Select
Columns("F:F").Select
ActiveSheet.Range("$F$1:$F$240").RemoveDuplicates Columns:=1, Header:=xlYes
End With
End With
End With