change header for tabs using vb where tab names are listed in a group of cells

Stevep4

New Member
Joined
Aug 28, 2015
Messages
35
I'm trying to updatespecific tabs with a header using Visual Basic. Below is the code I have sofar. It's pointing to a specific tab ("PrintPage") and looking at G12down on PrintPage and adding a new right page header. This code works like a charmwhen I want to print the list of tabs just by putting .PrintOut afterSheets(Ary). Instead of printing the tabs that are listed on column G onPrintpage, I want to change the headers for those tabs. I'm getting an error onthe pagesetup line.


Code:
SubChangeHeaders()
  Dim Ary As Variant
     With Sheets("PrintPage")
     Ary = Application.Transpose(.Range("G12",.Range("G" & Rows.Count).End(xlUp)).Value)
  End With
     Sheets(Ary).PageSetup.RightHeader = "New Header"
End Sub


Thanks
 

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,223,909
Messages
6,175,313
Members
452,634
Latest member
cpostell

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top