I've made an Excel macro that puts cell information from a sheet into the headers and footers. I've gotten as far as taking information from two separate cells and putting both in the same footer, but I would like them to be on different lines in the footer.
I was trying to use Sendkeys but that appears to work only in the active sheet, while I'm doing this to pull cells from the active sheet and put them in the headers/footers of other sheets.
Is there a way to get an "enter" value into the header/footer? My code below, I would like to have the values of B6 and B7 on seperate lines.
Sub VenueAndCompany()
'Puts in the venue and company name
Dim ws As Worksheet
For Each ws In ActiveWorkbook.Worksheets
ws.PageSetup.CenterFooter = "&""Futura-Normal,Bold""&14" & ActiveSheet.Range("B6") & ", " & "&""Futura-Normal,Bold""&14" & ActiveSheet.Range("B7").Value
Next ws
End Sub
you can use chr(10) to insert a line break
ws.PageSetup.CenterFooter = "&""Futura-Normal,Bold""&14" & ActiveSheet.Range("B6") & ", " & "&""Futura-Normal,Bold""&14" & chr(10) & ActiveSheet.Range("B7").Value
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With