Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Put cell contents into header

Hello.

This should be an easy one for someone. I want to take the contents of cell
INP.Cells(2,7) and put it into the right header of a worksheet so that what
is in the header changes if the cell contents change.

Here is the code I'm trying to use:

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & INP.Cells(2, 7)
End With

It doesn't return an error, but also does not put anything in the header.
Can anyone spot what's wrong with it?

Thanks,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 414
Default Put cell contents into header

Is INP the sheet name? If so you should set up a change event so that
the header is automatically changed when the value in G2 changes. Right
click the INP sheet tab, select View Code and paste the following event:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Count = 1 And Target.Address = "$G$2" Then
With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & Target.Value
End With
End If
End Sub

Hope this helps
Rowan

Marty wrote:
Hello.

This should be an easy one for someone. I want to take the contents of cell
INP.Cells(2,7) and put it into the right header of a worksheet so that what
is in the header changes if the cell contents change.

Here is the code I'm trying to use:

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & INP.Cells(2, 7)
End With

It doesn't return an error, but also does not put anything in the header.
Can anyone spot what's wrong with it?

Thanks,

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Put cell contents into header

Marty,

You need a space after the 36 in the header string.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Marty" wrote in message
...
Hello.

This should be an easy one for someone. I want to take the
contents of cell
INP.Cells(2,7) and put it into the right header of a worksheet
so that what
is in the header changes if the cell contents change.

Here is the code I'm trying to use:

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & INP.Cells(2, 7)
End With

It doesn't return an error, but also does not put anything in
the header.
Can anyone spot what's wrong with it?

Thanks,



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default Put cell contents into header

You need a space after the 36 in the header string.

Upon further reflection, you need the space only if the cell
value is numeric.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Marty,

You need a space after the 36 in the header string.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Marty" wrote in message
...
Hello.

This should be an easy one for someone. I want to take the
contents of cell
INP.Cells(2,7) and put it into the right header of a worksheet
so that what
is in the header changes if the cell contents change.

Here is the code I'm trying to use:

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & INP.Cells(2, 7)
End With

It doesn't return an error, but also does not put anything in
the header.
Can anyone spot what's wrong with it?

Thanks,





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 116
Default Put cell contents into header

That did it. The cell value is numeric, so it worked. Thanks very much.

"Chip Pearson" wrote:

You need a space after the 36 in the header string.


Upon further reflection, you need the space only if the cell
value is numeric.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com


"Chip Pearson" wrote in message
...
Marty,

You need a space after the 36 in the header string.


--
Cordially,
Chip Pearson
Microsoft MVP - Excel
Pearson Software Consulting, LLC
www.cpearson.com



"Marty" wrote in message
...
Hello.

This should be an easy one for someone. I want to take the
contents of cell
INP.Cells(2,7) and put it into the right header of a worksheet
so that what
is in the header changes if the cell contents change.

Here is the code I'm trying to use:

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & INP.Cells(2, 7)
End With

It doesn't return an error, but also does not put anything in
the header.
Can anyone spot what's wrong with it?

Thanks,








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default Put cell contents into header

What's INP?

Is it the name of the worksheet?
..RightHeader = "&""Arial,Bold""&36" & worksheets("INP").Cells(2, 7).value

Is it the code name for a different sheet?

=====

(.value isn't required, but I like it.)



Marty wrote:

Hello.

This should be an easy one for someone. I want to take the contents of cell
INP.Cells(2,7) and put it into the right header of a worksheet so that what
is in the header changes if the cell contents change.

Here is the code I'm trying to use:

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & INP.Cells(2, 7)
End With

It doesn't return an error, but also does not put anything in the header.
Can anyone spot what's wrong with it?

Thanks,


--

Dave Peterson
  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 97
Default Put cell contents into header


What is INP?

Do you mean?

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & Cells(2, 7).value
End With

"Marty" wrote in message
...
Hello.

This should be an easy one for someone. I want to take the contents of
cell
INP.Cells(2,7) and put it into the right header of a worksheet so that
what
is in the header changes if the cell contents change.

Here is the code I'm trying to use:

With Sheets("Sheet1").PageSetup
.RightHeader = "&""Arial,Bold""&36" & INP.Cells(2, 7)
End With

It doesn't return an error, but also does not put anything in the header.
Can anyone spot what's wrong with it?

Thanks,



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
Cell contents in header/footer mdavison Excel Worksheet Functions 5 October 23rd 06 08:18 PM
How do I enter the contents of a cell into a page header W Mather Excel Discussion (Misc queries) 1 May 15th 06 03:10 PM
Display cell contents in the Header or Footer? yost42 Excel Discussion (Misc queries) 1 December 28th 05 02:59 PM
Inserting Cell Contents into a header Darin Kramer Excel Programming 3 December 13th 04 02:27 PM
insert cell contents into page header ScottyV Excel Programming 1 November 16th 04 09:21 PM


All times are GMT +1. The time now is 04:23 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"