cierrasmadre
New Member
- Joined
- Jun 14, 2017
- Messages
- 9
I'm self taught and still learning, so please excuse my ignorance. I can create the code I need, but struggle when it comes to variables.
I have a pivot table that lists the error codes from my main records sheet and then gives the count for each error code. A pretty simple pivot table. This is a sample of the pivot table. Just 2 lines of it.
[TABLE="width: 585"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]DEMO.MASTER RECORD MISSING[/TD]
[TD="align: right"]399[/TD]
[/TR]
[TR]
[TD]DOS LT HOLD DAYS 10[/TD]
[TD="align: right"]25[/TD]
[/TR]
</tbody>[/TABLE]
I need to be able to extract the data from 2 of the errors to their own sheets. Manually, I'd find the error on the pivot table and double click the total to have a new worksheet created showing all of the data that goes with that error. I have a script that works, but I need it to account for variables. The total I'd currently click on is in field I81, but tomorrow may be I50 or I98, etc. I need a script that will look for errors "Demo.Master Record Missing" and "DOS LT Hold Days 10" and extract the data for these to a new sheet. The code I'm currently using is below. I'm looking for suggestions on how to update this to account for the variables day to day.
I have a pivot table that lists the error codes from my main records sheet and then gives the count for each error code. A pretty simple pivot table. This is a sample of the pivot table. Just 2 lines of it.
[TABLE="width: 585"]
<colgroup><col><col></colgroup><tbody>[TR]
[TD]DEMO.MASTER RECORD MISSING[/TD]
[TD="align: right"]399[/TD]
[/TR]
[TR]
[TD]DOS LT HOLD DAYS 10[/TD]
[TD="align: right"]25[/TD]
[/TR]
</tbody>[/TABLE]
I need to be able to extract the data from 2 of the errors to their own sheets. Manually, I'd find the error on the pivot table and double click the total to have a new worksheet created showing all of the data that goes with that error. I have a script that works, but I need it to account for variables. The total I'd currently click on is in field I81, but tomorrow may be I50 or I98, etc. I need a script that will look for errors "Demo.Master Record Missing" and "DOS LT Hold Days 10" and extract the data for these to a new sheet. The code I'm currently using is below. I'm looking for suggestions on how to update this to account for the variables day to day.
Code:
Sub Extract()
Sheets("Stats - All Records").Activate
Range("I81").Select
Selection.ShowDetail = True
Sheets("Stats - All Records").Select
Range("I82").Select
Selection.ShowDetail = True
End Sub