View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Datasort Datasort is offline
external usenet poster
 
Posts: 50
Default Changing Pivot Table Field Name

First of all, I would not use an input box but a form that has a combo box
attached that makes the user select a field that is valid. The user might
type Oct Costs or October costs which are different column heading names to
the pivot table.

I would be a create a custom tool bar that would have the drop down months
that are valid

Set myControl = CommandBars("Custom").Controls _
.Add(Type:=msoControlComboBox, Befo=1)
With myControl
.AddItem Text:="Jan Costs", Index:=1
.AddItem Text:="Feb Costs", Index:=2
€¦

.DropDownLines = 3
.DropDownWidth = 75
.ListHeaderCount = 0
End With

Do a search on CommandBarComboBox in the vba help to get a feel for setting
up the command bar combo box

Secondly, I would use the macro recorder to show what kind of code is needed
to remove a month and add a new month. Then use the change event of the combo
box do the changes for the macro recorder.

Best of luck
--
Stewart Rogers
DataSort Software, L.C.


"Carmen" wrote:

Hi,

I noticed that no matter how I change the name of a field in Pivot, when I
look at field properties I still see the original field name. Is there a
way to get the original field name? I want to constantly change the caption
of that particular field.

I want to change the name of a field from month to month (ie Sept Cost, Oct
Cost). I would request the user to input the month in an input box, but how
do I change the field? It's impossible to say replace "Sept Cost" with "Oct
Cost" because I do not keep track of the field index and won't know the
original name.

Thanks,
Carmen