Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default reference a cell within the header

I would like to enter the value from a cell into a header. For Example. I
want the header to say "Schedule C2 Attachment A" with the value of cell C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default reference a cell within the header

NikkiB,

Assuming your header is still in Sheet1:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = "Schedule C2 Attachment A" &
Sheets("Sheet1").Range("C2").Value
End Sub

hth,

Doug

"NikkiB" wrote in message
...
I would like to enter the value from a cell into a header. For Example. I
want the header to say "Schedule C2 Attachment A" with the value of cell
C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader =
Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default reference a cell within the header

Doug,

I'm sorry I don't think I explained my properly.

I tried the code and if the value in cell C2= "1" my header reads as follows:
Schedule C2 Attachment A1

I was hoping there would be a way to insert the value from cell C2 between
the words Schedule and Attachment so that my header would read as follows:
Schedule 1 Attachment A

Is this possible?

I apologize for the confusion.

Thank you so much for your time.

Nikki

"Doug Glancy" wrote:

NikkiB,

Assuming your header is still in Sheet1:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = "Schedule C2 Attachment A" &
Sheets("Sheet1").Range("C2").Value
End Sub

hth,

Doug

"NikkiB" wrote in message
...
I would like to enter the value from a cell into a header. For Example. I
want the header to say "Schedule C2 Attachment A" with the value of cell
C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader =
Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default reference a cell within the header

Nikki,

I think this will do what you want. Basically, you surround the unchanging
text in quotes and put the cell reference where you want it in the string
and then connect the various parts with ampersands:

Sheets("Sheet1").PageSetup.CenterHeader = "Schedule " &
Sheets("Sheet1").Range("C2").Value & " Attachment A"

hth,

Doug

"NikkiB" wrote in message
...
Doug,

I'm sorry I don't think I explained my properly.

I tried the code and if the value in cell C2= "1" my header reads as
follows:
Schedule C2 Attachment A1

I was hoping there would be a way to insert the value from cell C2 between
the words Schedule and Attachment so that my header would read as follows:
Schedule 1 Attachment A

Is this possible?

I apologize for the confusion.

Thank you so much for your time.

Nikki

"Doug Glancy" wrote:

NikkiB,

Assuming your header is still in Sheet1:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = "Schedule C2 Attachment A" &
Sheets("Sheet1").Range("C2").Value
End Sub

hth,

Doug

"NikkiB" wrote in message
...
I would like to enter the value from a cell into a header. For Example.
I
want the header to say "Schedule C2 Attachment A" with the value of
cell
C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for
what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader =
Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.




  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 9
Default reference a cell within the header

Thank you so much for your pateince.

That worked perfectly!

"Doug Glancy" wrote:

Nikki,

I think this will do what you want. Basically, you surround the unchanging
text in quotes and put the cell reference where you want it in the string
and then connect the various parts with ampersands:

Sheets("Sheet1").PageSetup.CenterHeader = "Schedule " &
Sheets("Sheet1").Range("C2").Value & " Attachment A"

hth,

Doug

"NikkiB" wrote in message
...
Doug,

I'm sorry I don't think I explained my properly.

I tried the code and if the value in cell C2= "1" my header reads as
follows:
Schedule C2 Attachment A1

I was hoping there would be a way to insert the value from cell C2 between
the words Schedule and Attachment so that my header would read as follows:
Schedule 1 Attachment A

Is this possible?

I apologize for the confusion.

Thank you so much for your time.

Nikki

"Doug Glancy" wrote:

NikkiB,

Assuming your header is still in Sheet1:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = "Schedule C2 Attachment A" &
Sheets("Sheet1").Range("C2").Value
End Sub

hth,

Doug

"NikkiB" wrote in message
...
I would like to enter the value from a cell into a header. For Example.
I
want the header to say "Schedule C2 Attachment A" with the value of
cell
C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for
what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader =
Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.






  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 63
Default reference a cell within the header

You're very welcome!

"NikkiB" wrote in message
...
Thank you so much for your pateince.

That worked perfectly!

"Doug Glancy" wrote:

Nikki,

I think this will do what you want. Basically, you surround the
unchanging
text in quotes and put the cell reference where you want it in the string
and then connect the various parts with ampersands:

Sheets("Sheet1").PageSetup.CenterHeader = "Schedule " &
Sheets("Sheet1").Range("C2").Value & " Attachment A"

hth,

Doug

"NikkiB" wrote in message
...
Doug,

I'm sorry I don't think I explained my properly.

I tried the code and if the value in cell C2= "1" my header reads as
follows:
Schedule C2 Attachment A1

I was hoping there would be a way to insert the value from cell C2
between
the words Schedule and Attachment so that my header would read as
follows:
Schedule 1 Attachment A

Is this possible?

I apologize for the confusion.

Thank you so much for your time.

Nikki

"Doug Glancy" wrote:

NikkiB,

Assuming your header is still in Sheet1:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = "Schedule C2 Attachment A" &
Sheets("Sheet1").Range("C2").Value
End Sub

hth,

Doug

"NikkiB" wrote in message
...
I would like to enter the value from a cell into a header. For
Example.
I
want the header to say "Schedule C2 Attachment A" with the value of
cell
C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for
what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader =
Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.





  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default reference a cell within the header

Is there a way to do it without Macros? I'm going to send this sheet around
to a bunch of users that my have security set too high for VBA stuff.
I'm having the user type their name into a named cell on the first sheet and
want to use that cell ("name") in the footer on the second sheet.

"Doug Glancy" wrote:

Nikki,

I think this will do what you want. Basically, you surround the unchanging
text in quotes and put the cell reference where you want it in the string
and then connect the various parts with ampersands:

Sheets("Sheet1").PageSetup.CenterHeader = "Schedule " &
Sheets("Sheet1").Range("C2").Value & " Attachment A"

hth,

Doug

"NikkiB" wrote in message
...
Doug,

I'm sorry I don't think I explained my properly.

I tried the code and if the value in cell C2= "1" my header reads as
follows:
Schedule C2 Attachment A1

I was hoping there would be a way to insert the value from cell C2 between
the words Schedule and Attachment so that my header would read as follows:
Schedule 1 Attachment A

Is this possible?

I apologize for the confusion.

Thank you so much for your time.

Nikki

"Doug Glancy" wrote:

NikkiB,

Assuming your header is still in Sheet1:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = "Schedule C2 Attachment A" &
Sheets("Sheet1").Range("C2").Value
End Sub

hth,

Doug

"NikkiB" wrote in message
...
I would like to enter the value from a cell into a header. For Example.
I
want the header to say "Schedule C2 Attachment A" with the value of
cell
C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for
what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader =
Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.




  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 24
Default reference a cell within the header

Even if the code works, the users will have to lower their security for it
to work on their computers.

Ross



"Nick Earnest" <Nick wrote in message
...
Is there a way to do it without Macros? I'm going to send this sheet
around
to a bunch of users that my have security set too high for VBA stuff.
I'm having the user type their name into a named cell on the first sheet
and
want to use that cell ("name") in the footer on the second sheet.

"Doug Glancy" wrote:

Nikki,

I think this will do what you want. Basically, you surround the
unchanging
text in quotes and put the cell reference where you want it in the string
and then connect the various parts with ampersands:

Sheets("Sheet1").PageSetup.CenterHeader = "Schedule " &
Sheets("Sheet1").Range("C2").Value & " Attachment A"

hth,

Doug

"NikkiB" wrote in message
...
Doug,

I'm sorry I don't think I explained my properly.

I tried the code and if the value in cell C2= "1" my header reads as
follows:
Schedule C2 Attachment A1

I was hoping there would be a way to insert the value from cell C2
between
the words Schedule and Attachment so that my header would read as
follows:
Schedule 1 Attachment A

Is this possible?

I apologize for the confusion.

Thank you so much for your time.

Nikki

"Doug Glancy" wrote:

NikkiB,

Assuming your header is still in Sheet1:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader = "Schedule C2 Attachment A" &
Sheets("Sheet1").Range("C2").Value
End Sub

hth,

Doug

"NikkiB" wrote in message
...
I would like to enter the value from a cell into a header. For
Example.
I
want the header to say "Schedule C2 Attachment A" with the value of
cell
C2
displayed within the header.

I found the below code but do not know if its possibe to adjust for
what I
need.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Sheets("Sheet1").PageSetup.CenterHeader =
Sheets("Sheet1").Range("A1").Value
End Sub

Thanks in advance for any help.






  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 67
Default reference a cell within the header

This question has been repeatedly asked and answered (thankfully) but I would
like to take it a step further. How would you format the text in that
header. Let's say you wanted the verbage in the CenterHeader to be in Arial,
Bold and size=14. So far I can get the text to appear with the Cell
reference but am not able to format 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 reference in header Terry Bennett Excel Worksheet Functions 2 September 7th 07 09:55 PM
reference cell in header Steve_n_KC Excel Worksheet Functions 0 May 17th 07 12:37 AM
cell reference in header Dana Excel Discussion (Misc queries) 3 January 30th 07 09:39 PM
cell reference in header row ML Excel Discussion (Misc queries) 4 August 26th 05 06:30 PM
Cell Reference in Header Dave Excel Discussion (Misc queries) 1 May 20th 05 08:56 PM


All times are GMT +1. The time now is 12:05 AM.

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"