Hi,
I'm trying to write some VBA code (and it's been awhile) to do the following:
I have a tab called 'WOs' and another tab called 'WOs (DSP Only)'.
I'm trying to first filter on the 'WOs' tab on column P to select only "DSP" and "REC".
Then I'd like to copy all data on the 'WOs' tab and paste as values starting in cell G1 on the 'WOs (DSP Only)' tab.
Then on the 'WOs (DSP Only)' tab I'm trying to have the following formulas and drag them all the way down to the last row:
In A2: =CONCATENATE(L2,"-",K2,"-",Z2,"-",X2) and copy all the way down to last row where there is data in column G
In B2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.5)} and copy all the way down to last row where there is data in column G
In C2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.65)} and copy all the way down to last row where there is data in column G
In D2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.75)} and copy all the way down to last row where there is data in column G
In E2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.9)} and copy all the way down to last row where there is data in column G
In F2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.99)} and copy all the way down to last row where there is data in column G
I know there has to be some VBA to do this and I have created part of it:
But it doesn't select all the data and I'm not sure how to populate the formulas on the 'WO's (DSP Only)' tab also.
Any help would be greatly appreciated.
Thanks!
I'm trying to write some VBA code (and it's been awhile) to do the following:
I have a tab called 'WOs' and another tab called 'WOs (DSP Only)'.
I'm trying to first filter on the 'WOs' tab on column P to select only "DSP" and "REC".
Then I'd like to copy all data on the 'WOs' tab and paste as values starting in cell G1 on the 'WOs (DSP Only)' tab.
Then on the 'WOs (DSP Only)' tab I'm trying to have the following formulas and drag them all the way down to the last row:
In A2: =CONCATENATE(L2,"-",K2,"-",Z2,"-",X2) and copy all the way down to last row where there is data in column G
In B2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.5)} and copy all the way down to last row where there is data in column G
In C2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.65)} and copy all the way down to last row where there is data in column G
In D2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.75)} and copy all the way down to last row where there is data in column G
In E2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.9)} and copy all the way down to last row where there is data in column G
In F2: {=PERCENTILE.INC(IF($A$2:$A$2=A2,$AF$2:$AF$2),0.99)} and copy all the way down to last row where there is data in column G
I know there has to be some VBA to do this and I have created part of it:
Code:
Sub WODSPTab()
'
' WODSPTab Macro
'
'Filter
Worksheets("WOs").Range("A1").AutoFilter _
Field:=16, Criteria1:="=DSP" _
, Operator:=xlOr, Criteria2:="=REC"
'Paste Data from WO's Tab to WOs (DSP Only) tab
Sheets("WOs").Select
Range("A1").Select
Range(Selection, Selection.End(xlToRight).End(xlDown)).Select
Selection.Copy
Sheets("WOs (DSP Only)").Select
Range("G1").Select
Selection.PasteSpecial Paste:=xlPasteValuesAndNumberFormats, Operation:= _
xlNone, SkipBlanks:=False, Transpose:=False
End Sub
But it doesn't select all the data and I'm not sure how to populate the formulas on the 'WO's (DSP Only)' tab also.
Any help would be greatly appreciated.
Thanks!