Macro Storage Location

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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.
 
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
 
Back
Top