I'm going to show you how to set up an automatic macro that will run headers
and footers in all your documents now headers and footers are fairly easy to
do but if you have a large document or you have numerous sheets it's very handy
to have one in your macros so I'm going to show you what I've got it here so
this is open to all workbooks and so we're gonna save it in our personal
workbook and now I'm gonna run this and this sheet has basically nothing on it
so let's go to this view you can see it says prepared by barb Henderson and the
date and then it has on the bottom page one of whatever book one is what this
files name and I'm working on sheet 1 now let's go see how it's gonna look on
a big big one so I open up a file and I happen to have a file that's very big it
has numerous sheets on it and each one of these sheets has masses of data on it
so what I'm going to do is I'm going to go back to my my Developer tab and I'm
going to click on the macros and I'm going to run header and it goes around a
bit okay so now let's let's just open up a couple of them and it's gone through
each sheet and so I'm gonna go onto my my view so I can see my headers and
footers and if we go through each and every sheet we can see that it has put
headers and footer on every sheet so you don't have to do it individually it'll
automatically put them on there so let's look at the code so here's my code
defining WS is a worksheet and for each worksheet in the workbook what it's
doing is going through and you can obviously change
any of this to suit what you need but it's putting mighty God it's putting the
name on the top it's putting the date and it's putting page 1 of how many
pages there is and it's putting the filename and it's putting the worksheet
the worksheet here the sheet name on the end and the rest of this is just to set
up to set up how your margins are going to look now I will include this code in
your in the description of the video but the most important thing is to save this
in your personal personal personal workbook so that it will open up in
every sheet that you're in so there's two ways of doing that you can copy the
code into into this or another way of doing it would be when you go to record
a macro you could just record a macro and just start it and then what you're
gonna do it is you're gonna save it in your personal macro book and just name
it whatever and then close it as soon as you open it and then you were able to
copy go step into the code after it's there um so I'm gonna put put another
one and I'm gonna call this one example
and I'm gonna say ok and now I'm gonna stop this right away and then what I'm
gonna do is I am going to go to macros and I'm going to step into it and then
when I would do is I would copy the code that I'm going to demonstrate can it
provide you in the description I would copy it ready in here and then you would
have your your macro gives you headers and footers on every sheet always
available to you in your personal workbook macro workbook so this is how
you create a macro that will create headers and footers on every sheet that
you you use please subscribe