Slarbie/JMay, got a tight deadline on this. I use loops from time to time but
not sure how to pick up the field and set as variable then loop till last
column (within the pivot VB code) . There can be anything from 60 -80
columns. have you got any example loops to pick up the header, add as data
field then move to next column until completed?
Thanks for the quick responses guys :-)
"slarbie" wrote:
> Jmay's suggestion actually is a good one. Even if you can't record the exact
> final result you want, you can use the recorder to see the correctly coded
> syntax for talking to a pivot table through VBA code. Then modify with some
> variables and looping to account for how many columns need to be added, and
> you're essentially there. Added bonus of being a great way to build your own
> VB skills! 
>
>
> "JimmyA" wrote:
>
> > The number of columns from C onwards can be variable so recording isn't
> > appropriate
> >
> > "JMay" wrote:
> >
> > > Have you tried Recording a Macro to see what it provides you with?
> > > Macro Recorder is your friend...
> > >
> > > "JimmyA" wrote:
> > >
> > > > Hi Guys
> > > >
> > > > I need a macro to create a pivot table for multiple columns. I need column A
> > > > and B as Row Fields. Colums C to column x (variable) need to be added
> > > > automatically as Pivot fields. The headers for column C to x will be variable.
> > > >
> > > > thanks in advance...