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

Select all contiguous cells
Pressing Ctrl+* (asterisk) will select the "current region" - all contiguous cells in all directions.

Forum statistics

Threads
1,224,823
Messages
6,181,181
Members
453,022
Latest member
Mohamed Magdi Tawfiq Emam

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