Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Code to put contents of A1 and B1 in header

I would like to put the contents of A1 and B1 into the
header. A1 and B1 are not names of columns.

Is there a way to do this? I came up with zip when
searching Help.

Sandy
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code to put contents of A1 and B1 in header

If you mean in the gray labels, no. You can make them (A1 and B1) look
similar to labels using formatting and hide the labels, but I am not sure of
the utility of that.

Regards,
Tom Ogilvy

Sandy wrote in message
...
I would like to put the contents of A1 and B1 into the
header. A1 and B1 are not names of columns.

Is there a way to do this? I came up with zip when
searching Help.

Sandy



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Code to put contents of A1 and B1 in header

Dear Tom:

Thanks for your reply. I mean that I have text in Cell A1
and text in Cell A2. I would like that text to display in
the Header of each printed sheet.

Sandy

-----Original Message-----
If you mean in the gray labels, no. You can make them

(A1 and B1) look
similar to labels using formatting and hide the labels,

but I am not sure of
the utility of that.

Regards,
Tom Ogilvy

Sandy wrote in message
...
I would like to put the contents of A1 and B1 into the
header. A1 and B1 are not names of columns.

Is there a way to do this? I came up with zip when
searching Help.

Sandy



.

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Code to put contents of A1 and B1 in header

Sorry - misinterpreted what you meant by header.

You can put it in the header using code such as Gordon provided (as
corrected).

Or you can try using rows to repeat at top in the last tab of the page setup
dialog.


--
Regards,
Tom Ogilvy


Sandy wrote in message
...
Dear Tom:

Thanks for your reply. I mean that I have text in Cell A1
and text in Cell A2. I would like that text to display in
the Header of each printed sheet.

Sandy

-----Original Message-----
If you mean in the gray labels, no. You can make them

(A1 and B1) look
similar to labels using formatting and hide the labels,

but I am not sure of
the utility of that.

Regards,
Tom Ogilvy

Sandy wrote in message
...
I would like to put the contents of A1 and B1 into the
header. A1 and B1 are not names of columns.

Is there a way to do this? I came up with zip when
searching Help.

Sandy



.



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 51
Default Code to put contents of A1 and B1 in header

Thanks Tom, for the heads up.

I got no error, but the code also did not place the cell contents in the
Header as I thought.

Gord

On Sun, 17 Aug 2003 16:56:37 -0400, "Tom Ogilvy" wrote:


.Range("A1:B2").Text gives an error

.Range("A1").Text & " " & .Range("B1").Text

maybe what you meant.




  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Code to put contents of A1 and B1 in header

Thank you very much!

Sandy
-----Original Message-----
Sorry - misinterpreted what you meant by header.

You can put it in the header using code such as Gordon

provided (as
corrected).

Or you can try using rows to repeat at top in the last

tab of the page setup
dialog.


--
Regards,
Tom Ogilvy


Sandy wrote in message
...
Dear Tom:

Thanks for your reply. I mean that I have text in Cell

A1
and text in Cell A2. I would like that text to display

in
the Header of each printed sheet.

Sandy

-----Original Message-----
If you mean in the gray labels, no. You can make them

(A1 and B1) look
similar to labels using formatting and hide the labels,

but I am not sure of
the utility of that.

Regards,
Tom Ogilvy

Sandy wrote in message
...
I would like to put the contents of A1 and B1 into

the
header. A1 and B1 are not names of columns.

Is there a way to do this? I came up with zip when
searching Help.

Sandy


.



.

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 43
Default Code to put contents of A1 and B1 in header

Thanks, Gord!

Sandy
-----Original Message-----
Thanks Tom, for the heads up.

I got no error, but the code also did not place the cell

contents in the
Header as I thought.

Gord

On Sun, 17 Aug 2003 16:56:37 -0400, "Tom Ogilvy"

wrote:


.Range("A1:B2").Text gives an error

.Range("A1").Text & " " & .Range("B1").Text

maybe what you meant.


.

  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 77
Default Code to put contents of A1 and B1 in header

It appears that in Excel XP, the ".LeftHeader " line is just skipped (with
no error for me either) when it encounters a run time error (
..Range("A1:B1").Text ). Don't know about earlier version though.


Sub CellInHeader()
With ActiveSheet.PageSetup
.LeftHeader = [A1] & Space(1) & [B1]
'...etc
End With
End Sub

--
Dana DeLouis
Using Windows XP & Office XP
= = = = = = = = = = = = = = = = =


"Tom Ogilvy" wrote in message
...

.Range("A1:B2").Text gives an error

.Range("A1").Text & " " & .Range("B1").Text

maybe what you meant.

--
Regards,
Tom Ogilvy

Gord Dibben wrote in message
...
Sandy

Sub CellInHeader()
With ActiveSheet
.PageSetup.LeftHeader = .Range("A1:B1").Text
End With
End Sub

You could also place this code as a BeforePrint in the Thisworkbook

module.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
With ActiveSheet
.PageSetup.LeftHeader = .Range("A1:B1").Text
End With
End Sub

Gord Dibben Excel MVP XL2002


On Sun, 17 Aug 2003 13:11:12 -0700, "Sandy"

wrote:

I would like to put the contents of A1 and B1 into the
header. A1 and B1 are not names of columns.

Is there a way to do this? I came up with zip when
searching Help.

Sandy






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
what code pulls in contents of a cell in an Excel header/footer? Ronnyk Excel Discussion (Misc queries) 3 September 13th 07 08:18 PM
Omit header from first page without embedding header in code ibvalentine Excel Worksheet Functions 6 August 28th 07 05:10 AM
Cell contents in header/footer mdavison Excel Worksheet Functions 5 October 23rd 06 08:18 PM
Display cell contents in the Header or Footer? yost42 Excel Discussion (Misc queries) 1 December 28th 05 02:59 PM
Insert cell contents into header/footer joeeng Excel Discussion (Misc queries) 7 July 21st 05 11:01 PM


All times are GMT +1. The time now is 10:19 PM.

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

About Us

"It's about Microsoft Excel"