Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
mykmag
 
Posts: n/a
Default Can one insert a variable/cell ref. in the heading

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?
  #2   Report Post  
Dave Peterson
 
Posts: n/a
Default

If you use VBA, you can.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1")
.PageSetup.RightHeader = "This is what's in A1: " & .Range("A1").Text
.PageSetup.LeftHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub

This kind of code goes behind the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

mykmag wrote:

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?


--

Dave Peterson
  #3   Report Post  
mykmag
 
Posts: n/a
Default

Thank you very much. Of your name I guess you are of Swedish origin. I
myself, is Norwegian.
I would like to know if VisualBasic,VBA is build in Excel 2003 or must I
have the whole program to make a macro? I think I have a CD with some old
program on, and I have some programming experience mainly with dBASE and a
litle Pascal and I have tried some VBA as well (very little).
Yours
Magnar Myklebust (retired)
Ellingsrudlia 24
1400 Ski
Norway
E-mail

"Dave Peterson" wrote:

If you use VBA, you can.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1")
.PageSetup.RightHeader = "This is what's in A1: " & .Range("A1").Text
.PageSetup.LeftHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub

This kind of code goes behind the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

mykmag wrote:

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?


--

Dave Peterson

  #4   Report Post  
Dave Peterson
 
Posts: n/a
Default

VBA is built into excel (as well a bunch of other programs). But I believe you
do have to choose to install it.

If you click on Tools|macro|Visual basic editor, do you have any problems?

(VB--plain old Visual Basic is a stand alone program. But you don't need it to
write macros in excel/word/powerpoint....).

mykmag wrote:

Thank you very much. Of your name I guess you are of Swedish origin. I
myself, is Norwegian.
I would like to know if VisualBasic,VBA is build in Excel 2003 or must I
have the whole program to make a macro? I think I have a CD with some old
program on, and I have some programming experience mainly with dBASE and a
litle Pascal and I have tried some VBA as well (very little).
Yours
Magnar Myklebust (retired)
Ellingsrudlia 24
1400 Ski
Norway
E-mail

"Dave Peterson" wrote:

If you use VBA, you can.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1")
.PageSetup.RightHeader = "This is what's in A1: " & .Range("A1").Text
.PageSetup.LeftHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub

This kind of code goes behind the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

mykmag wrote:

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?


--

Dave Peterson


--

Dave Peterson
  #5   Report Post  
mykmag
 
Posts: n/a
Default



"Dave Peterson" wrote:

VBA is built into excel (as well a bunch of other programs). But I believe you
do have to choose to install it.

If you click on Tools|macro|Visual basic editor, do you have any problems?

(VB--plain old Visual Basic is a stand alone program. But you don't need it to
write macros in excel/word/powerpoint....).

mykmag wrote:

Thank you very much. Of your name I guess you are of Swedish origin. I
myself, is Norwegian.
I would like to know if VisualBasic,VBA is build in Excel 2003 or must I
have the whole program to make a macro? I think I have a CD with some old
program on, and I have some programming experience mainly with dBASE and a
litle Pascal and I have tried some VBA as well (very little).
Yours
Magnar Myklebust (retired)
Ellingsrudlia 24
1400 Ski
Norway
E-mail

"Dave Peterson" wrote:

If you use VBA, you can.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1")
.PageSetup.RightHeader = "This is what's in A1: " & .Range("A1").Text
.PageSetup.LeftHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub

This kind of code goes behind the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

mykmag wrote:

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?

--

Dave Peterson


--

Dave Peterson



  #6   Report Post  
mykmag
 
Posts: n/a
Default

Thank you for your answer.
I have no problems getting the code in the editor, and it compiles) without
any messages. But when I put some text i A1 inn sheet1 I cannot see any
result in neither heading noe footer after having run the program. I need a
litle detailed help here. I have programmed in dBASE and a little in Pascal
(and Simula/Basic/Fortran) but that was many years ago. And this is a whole
new story. I use a downloaded version of excel 2003.I think thou I understand
the main lines in the program. But I keep getting no result . I supose I may
put the program in the wrong place- shall it be placed in the sheet1 or in a
module?
Thank you
Magnar M.





"Dave Peterson" wrote:

VBA is built into excel (as well a bunch of other programs). But I believe you
do have to choose to install it.

If you click on Tools|macro|Visual basic editor, do you have any problems?

(VB--plain old Visual Basic is a stand alone program. But you don't need it to
write macros in excel/word/powerpoint....).

mykmag wrote:

Thank you very much. Of your name I guess you are of Swedish origin. I
myself, is Norwegian.
I would like to know if VisualBasic,VBA is build in Excel 2003 or must I
have the whole program to make a macro? I think I have a CD with some old
program on, and I have some programming experience mainly with dBASE and a
litle Pascal and I have tried some VBA as well (very little).
Yours
Magnar Myklebust (retired)
Ellingsrudlia 24
1400 Ski
Norway
E-mail

"Dave Peterson" wrote:

If you use VBA, you can.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1")
.PageSetup.RightHeader = "This is what's in A1: " & .Range("A1").Text
.PageSetup.LeftHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub

This kind of code goes behind the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

mykmag wrote:

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?

--

Dave Peterson


--

Dave Peterson

  #7   Report Post  
Dave Peterson
 
Posts: n/a
Default

Make sure you put the code under the ThisWorkbook module.

And this routine isn't designed to run on demand (manually). Instead it runs
when you print or printpreview.



mykmag wrote:

Thank you for your answer.
I have no problems getting the code in the editor, and it compiles) without
any messages. But when I put some text i A1 inn sheet1 I cannot see any
result in neither heading noe footer after having run the program. I need a
litle detailed help here. I have programmed in dBASE and a little in Pascal
(and Simula/Basic/Fortran) but that was many years ago. And this is a whole
new story. I use a downloaded version of excel 2003.I think thou I understand
the main lines in the program. But I keep getting no result . I supose I may
put the program in the wrong place- shall it be placed in the sheet1 or in a
module?
Thank you
Magnar M.

"Dave Peterson" wrote:

VBA is built into excel (as well a bunch of other programs). But I believe you
do have to choose to install it.

If you click on Tools|macro|Visual basic editor, do you have any problems?

(VB--plain old Visual Basic is a stand alone program. But you don't need it to
write macros in excel/word/powerpoint....).

mykmag wrote:

Thank you very much. Of your name I guess you are of Swedish origin. I
myself, is Norwegian.
I would like to know if VisualBasic,VBA is build in Excel 2003 or must I
have the whole program to make a macro? I think I have a CD with some old
program on, and I have some programming experience mainly with dBASE and a
litle Pascal and I have tried some VBA as well (very little).
Yours
Magnar Myklebust (retired)
Ellingsrudlia 24
1400 Ski
Norway
E-mail

"Dave Peterson" wrote:

If you use VBA, you can.

Option Explicit
Private Sub Workbook_BeforePrint(Cancel As Boolean)
With Worksheets("sheet1")
.PageSetup.RightHeader = "This is what's in A1: " & .Range("A1").Text
.PageSetup.LeftHeader = Format(Date, "mmmm dd, yyyy")
End With
End Sub

This kind of code goes behind the ThisWorkbook module.

If you're new to macros, you may want to read David McRitchie's intro at:
http://www.mvps.org/dmcritchie/excel/getstarted.htm

mykmag wrote:

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?

--

Dave Peterson


--

Dave Peterson


--

Dave Peterson
  #8   Report Post  
mykmag
 
Posts: n/a
Default

Thank you so much.
I got it right this time wth your help.
Thanks for use of your time.
Magnar M:

"mykmag" wrote:

Is it possibe to insert a cell referance/link of your own make, in the
heading/footer of a page/sheet in Excel 2003?

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Simultaneouly insert of rows or col. - Ajit Ajit Munj Excel Discussion (Misc queries) 1 March 23rd 05 09:17 AM
How do I insert a heading into a column Essee68 Excel Worksheet Functions 1 March 15th 05 12:47 PM
insert picture BillGwyer Excel Discussion (Misc queries) 1 March 4th 05 06:37 PM
Insert Line Macro Spyder Excel Discussion (Misc queries) 1 March 3rd 05 12:17 AM
Challenging Charting C TO Charts and Charting in Excel 0 January 17th 05 06:57 PM


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

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"