ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   pivot field definition in VBA (https://www.excelbanter.com/excel-programming/331971-pivot-field-definition-vba.html)

BorisS

pivot field definition in VBA
 
How can I get VBA to figure out what is in position 1 or 2 or whatever of the
rows in a table? In other words, when I am recording a macro and, for
example, dragging out a row field, the recording takes the actual name of
that field and makes it invisible. But if I am in a situation where a user
is going to be manipulating this and I want Excel to automatically take out,
say, the second grouping of a table, without my knowing ahead of time what
that second grouping will be at the time the macro is run, then how do I tell
it "drag out whatever field is in position 2"?

Thx.
--
Boris

Roger Whitehead

pivot field definition in VBA
 
Boris, try:

ActiveSheet.PivotTables("SalesPvt").ColumnFields(2 ).Orientation = xlHidden


--
HTH
Roger
Shaftesbury (UK)


"BorisS" wrote in message
...
How can I get VBA to figure out what is in position 1 or 2 or whatever of
the
rows in a table? In other words, when I am recording a macro and, for
example, dragging out a row field, the recording takes the actual name of
that field and makes it invisible. But if I am in a situation where a
user
is going to be manipulating this and I want Excel to automatically take
out,
say, the second grouping of a table, without my knowing ahead of time what
that second grouping will be at the time the macro is run, then how do I
tell
it "drag out whatever field is in position 2"?

Thx.
--
Boris





All times are GMT +1. The time now is 12:32 PM.

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