Hello all,
I am trying to have a pivot table that sorts the columns in a particular order. The issue is that if i use pivotitems.position = X, then I have to have a separate hidden function that tests to see if all the choices are there and if not then sort this way, and....well, I have 7 possible choices so trying to account for even half the combinations is not feasible. So then I tried making a sort variable dummy field, but then if I try to hide that so it doesn't display in the pivot table, the sort order goes back to default.
This is my attempt at some code. In this "IsItem" is calling a private boolean function:
This is just a few examples of what all combinations are possible. And as the data change, the combination possibilities will change, too.
ALL STATUS POSSIBILITIES AND ORDER
1. No Data
2. Incomplete
3. Complete
4. Partial Monitored
5. Monitored
6. Reviewed
7. Locked
Since STUDYNAME is newer it is really looking like this right now:
1. No Data
2. Incomplete
3. Complete
4. Partial Monitored
5. Monitored
And it looks like this in cases where there’s no partially monitored CRFs:
1. No Data
2. Incomplete
3. Complete
4. Monitored
Any and all help is very much appreciated! Thank you!
I am trying to have a pivot table that sorts the columns in a particular order. The issue is that if i use pivotitems.position = X, then I have to have a separate hidden function that tests to see if all the choices are there and if not then sort this way, and....well, I have 7 possible choices so trying to account for even half the combinations is not feasible. So then I tried making a sort variable dummy field, but then if I try to hide that so it doesn't display in the pivot table, the sort order goes back to default.
This is my attempt at some code. In this "IsItem" is calling a private boolean function:
Code:
If IsItem(ActiveSheet.PivotTables("All iCRF Status"), "iCRF Status", "Partial Monitored") _And IsItem(ActiveSheet.PivotTables("All iCRF Status"), "iCRF Status", "Reviewed") Then
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("No Data").Position = 1
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Incomplete").Position = 2
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Complete").Position = 3
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Partial Monitored").Position = 4
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Monitored").Position = 5
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Reviewed").Position = 6
'ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Locked").Position = 7
ElseIf IsItem(ActiveSheet.PivotTables("All iCRF Status"), "iCRF Status", "Reviewed") Then
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("No Data").Position = 1
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Incomplete").Position = 2
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Complete").Position = 3
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Monitored").Position = 4
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Reviewed").Position = 5
'ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Locked").Position = 6
Else
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("No Data").Position = 1
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Incomplete").Position = 2
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Complete").Position = 3
ActiveSheet.PivotTables("All iCRF Status").PivotFields("iCRF Status").PivotItems("Monitored").Position = 4
End If
This is just a few examples of what all combinations are possible. And as the data change, the combination possibilities will change, too.
ALL STATUS POSSIBILITIES AND ORDER
1. No Data
2. Incomplete
3. Complete
4. Partial Monitored
5. Monitored
6. Reviewed
7. Locked
Since STUDYNAME is newer it is really looking like this right now:
1. No Data
2. Incomplete
3. Complete
4. Partial Monitored
5. Monitored
And it looks like this in cases where there’s no partially monitored CRFs:
1. No Data
2. Incomplete
3. Complete
4. Monitored
Any and all help is very much appreciated! Thank you!