Does Rowfields exists?

A

Andrew

Hi,

I have a number of worksheets with Pivot Tables on them. I also have a list
of Rowfields.

Lets say the worksheets are called Sheet1, Sheet2 etc and the RowFields are
called Field1, Field 2 etc.

I'm trying to create a list on a control sheet (CONTROL) with the following
layout:

Sheet Field Exists
Sheet1 Field1 Yes
Sheet1 Field 2 No
Sheet2 Field 1 Yes
Sheet2 Field 2 Yes
............................
.............................

And so on.....
 
R

rylo

Hi

Assuming that your sheet names are on Control, starting in A2 then try


Code:
--------------------
Sub bbb()
With Sheets("Control")
For Each ce In .Range("A2:A" & .Cells(Rows.Count, 1).End(xlUp).Row)
On Error Resume Next
Set xx = Nothing
Set xx = Sheets(ce.Value).PivotTables(1).RowFields(ce.Offset(0, 1).Value)
If xx Is Nothing Then
ce.Offset(0, 2).Value = "NO"
Else
ce.Offset(0, 2).Value = "YES"
End If
Next ce
End With
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top