I've been pondering about this problem. To simply put, I want to automate making Executive Summary for our company. I want to add Right Header on pages 2 onwards while leaving the first page with blank header. The problem is, the text I want to use is a combination of text from different references. I did concatenate it into a single cell on another sheet and I want to use that cell as the reference for my header. Can someone help me on this. Thank you so much in advance.
I tried vba using this code
ActiveSheet.PageSetup.DifferentFirstPageHeaderFooter = True
ActiveSheet.PageSetup.RightHeader = "the text I want to reference"
ActiveSheet.PageSetup.FirstPage.CenterHeader.Text = ""
if I change the RightHeader
ActiveSheet.PageSetup.RightHeader = otherSheet.Range("A2").Value
it returns an error. Run-time error '1004': "Unable to set the RightHeader property of the PageSetup class"
I've been pondering about this problem. To simply put, I want to automate making Executive Summary for our company. I want to add Right Header on pages 2 onwards while leaving the first page with blank header. The problem is, the text I want to use is a combination of text from different references. I did concatenate it into a single cell on another sheet and I want to use that cell as the reference for my header. Can someone help me on this. Thank you so much in advance.
I tried vba using this code
ActiveSheet.PageSetup.DifferentFirstPageHeaderFooter = True
ActiveSheet.PageSetup.RightHeader = "the text I want to reference"
ActiveSheet.PageSetup.FirstPage.CenterHeader.Text = ""
if I change the RightHeader
ActiveSheet.PageSetup.RightHeader = otherSheet.Range("A2").Value
it returns an error. Run-time error '1004': "Unable to set the RightHeader property of the PageSetup class"
Share asked 23 hours ago Light HouseLight House 1 New contributor Light House is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct. 8 | Show 3 more comments1 Answer
Reset to default 0Below codes works to me where Sheet2 C1
cell has context Test Header.
ActiveSheet.PageSetup.DifferentFirstPageHeaderFooter = True
ActiveSheet.PageSetup.RightHeader = Sheets("Sheet2").Range("C1").Text
ActiveSheet.PageSetup.FirstPage.CenterHeader.Text = ""
otherSheet
? or do you set proper sheet tootherSheet
? – Harun24hr Commented 23 hours agoObject required
error for me. – Black cat Commented 23 hours ago