ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Macro Storage Location (https://www.excelbanter.com/excel-discussion-misc-queries/158648-macro-storage-location.html)

Richard

Macro Storage Location
 
OS: MS XP
Excel: 2002

I have a macro which I use to update the page Settings in an Excel file.
What I dont know how to do is:
1) Have the macro read the value at the start of its 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.

--
Richard

FSt1

Macro Storage Location
 
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

"Richard" wrote:

OS: MS XP
Excel: 2002

I have a macro which I use to update the page Settings in an Excel file.
What I dont know how to do is:
1) Have the macro read the value at the start of its 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.

--
Richard



All times are GMT +1. The time now is 12:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com