Share via

Excel VBA Footer fontsize problem

Anonymous
2023-07-27T10:36:07+00:00

Hello, I have a starter sheet in Excel where to change the date (like 2023-07) and i want to update every other sheet with that "date" in the right footer in font size 18. I've managed to get 2023-07 everywhere but the fontsize doesn't fit.

Sub testfooter_date()

Dim datum As String

datum = Sheets("Startersheet").Range("C2")  

Sheets("table1").Select 

With ActiveSheet.PageSetup 

    .RightFooter = datum 

End With

If I try to change that with what I found online the "-07" is huge in the excel background (hard to describe that correctly) and nothing in the right footer, but it works perfectly fine if there is only a text like "test" . Sadly i can't upload a screenshot (always an error)

datum = Sheets("Startersheet").Range("C2")

ActiveSheet.PageSetup.RightFooter = "&""Calibri""&18" & Sheets("Startersheet").Range("C2")

I hope my problem is formulated understandably

Thank you in advance

Win11 - Office 365

Microsoft 365 and Office | Excel | For education | Windows

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

Answer accepted by question author

HansV 462.6K Reputation points
2023-07-27T10:41:36+00:00

Because there is no space after the font size 18, the font size becomes the concatenation of 18 and the first part of the date.

Try

ActiveSheet.PageSetup.RightFooter = "&""Calibri""&18 " & Sheets("Startersheet").Range("C2")

(I added a space after 18)

Was this answer helpful?

1 person found this answer helpful.
0 comments No comments

1 additional answer

Sort by: Most helpful
  1. Anonymous
    2023-07-27T11:00:27+00:00

    Thank you so much :)

    Was this answer helpful?

    0 comments No comments