Hi,
I am trying to keep my Row Title that I created in line with the last column of pivot table report, but for some reason it always spills over an extra column. Here my code below and the code the for the two functions I created.
Number2Char Function:
LastColumn Function:
I am trying to keep my Row Title that I created in line with the last column of pivot table report, but for some reason it always spills over an extra column. Here my code below and the code the for the two functions I created.
Code:
'ActiveSheet.PivotTables("PivotTax").ShowDrillIndicators = False
Range("A5:" & Number2Char(LastColumn) & "5").Select
ActiveCell.Formula = "Tax Report"
Selection.Font.Bold = True
With Selection.Font
.Name = "Arial"
.Size = 14
.Strikethrough = False
.Superscript = False
.Subscript = False
.OutlineFont = False
.Shadow = False
.Underline = xlUnderlineStyleNone
.ColorIndex = 1
'.TintAndShade = 0
'.ThemeFont = xlThemeFontNone
End With
Selection.HorizontalAlignment = xlCenterAcrossSelection
Number2Char Function:
Code:
Function Number2Char(c As Integer) As String
Number2Char = Split(Cells(1, c).Address, "$")(1)
End Function
LastColumn Function:
Code:
Function LastColumn() As Long
Dim ix As Long
ix = ActiveSheet.UsedRange.Column - 1 + ActiveSheet.UsedRange.Columns.Count
LastColumn = ix
End Function