Forum Discussion
sTambux05
Jan 30, 2024Copper Contributor
Row height of pivot table
Hello to all,
I have a file with a pivot table, and when I update the row height and content font size varies automatically despite my attempts to reformat cells. How can I solve the problem?
Thank you
- AshaKantaSharmaIron ContributorFor precise control over row heights and font sizes, you can use VBA (Visual Basic for Applications) to set these properties. Here’s a basic example of how to set row height and font size:
vba
Copy code
Sub AdjustPivotFormatting()
Dim ws As Worksheet
Set ws = ThisWorkbook.Sheets("YourSheetName")
With ws.PivotTables("YourPivotTableName")
.RowAxisLayout xlTabularRow
.RowFields(1).DataRange.Rows.RowHeight = 20
.DataBodyRange.Font.Size = 12
End With
End Sub
Adjust "YourSheetName" and "YourPivotTableName" accordingly.