ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   access to xls (https://www.excelbanter.com/excel-programming/386505-access-xls.html)

yogi

access to xls
 
if i have a pivot table

how can i search multiple values by the label so that i can populate a new
spreadsheet

ex

you will notice in my 2 tables below that in my pivot table i don't have a
column b
but on my new table I do. How would i do this with code?

pivot table
a c d
a 1
b 2
c 3



new table

a b c d
a 1
b 2
c 3

Datasort

access to xls
 
I am not quite sure where you are heading with the question but I think you
should be using the the ColumnRange property of a pivottable. Below is a way
to list all the columns in the pivot table range. Note that there are title
and Pivot value rows.


Sub PrintPivotLabels


Dim c As Object

Debug.Print "There are " &
ActiveSheet.PivotTables(1).ColumnRange.Cells.Count & " Columns"

For Each c In ActiveSheet.PivotTables(1).ColumnRange
Debug.Print c.Address & ":" & c.Value
next C

End Sub

Good Luck

--
Stewart Rogers
DataSort Software, L.C.




All times are GMT +1. The time now is 06:02 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com