Macro Storage Location

R

Richard

OS: MS XP
Excel: 2002

I have a macro which I use to update the page Settings in an Excel file.
What I don’t know how to do is:
1) Have the macro read the value at the start of it’s execution from cell B1.
2) Store the value found in cell B1.
3) At the end of the macro execution write the value from B1 to the Custom
Header section in the page setup. Left Section:.

Thanks in advanced.
 
F

FSt1

hi.
1.use a variable.
dim stg as sting
2. store the string in B1
stg - range("B1").value
3 set the left header. (i did this part on record so you can see the whole
thing. I never could remember them all.)
With ActiveSheet.PageSetup
.LeftHeader = stg
.CenterHeader = ""
.RightHeader = ""
.LeftFooter = ""
.CenterFooter = ""
.RightFooter = ""
.LeftMargin = Application.InchesToPoints(0.75)
.RightMargin = Application.InchesToPoints(0.75)
.TopMargin = Application.InchesToPoints(1)
.BottomMargin = Application.InchesToPoints(1)
.HeaderMargin = Application.InchesToPoints(0.5)
.FooterMargin = Application.InchesToPoints(0.5)
.PrintHeadings = False
.PrintGridlines = False
.PrintComments = xlPrintNoComments
.PrintQuality = 600
.CenterHorizontally = False
.CenterVertically = False
.Orientation = xlPortrait
.Draft = False
.PaperSize = xlPaperLetter
.FirstPageNumber = xlAutomatic
.Order = xlDownThenOver
.BlackAndWhite = False
.Zoom = 100
.PrintErrors = xlPrintErrorsDisplayed
End With

basicly, declare the variable, assign it a value, use the varible to set the
left header or any other header or footer.

hope this helped.
regards
FSt1
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top