Title pretty much says it all. I simply want to be able to have the
contents of a cell entered as text in my header. For example I want my
header to read quot;Part #1234quot;. In cell D6 the actual part number quot;1234quot;
is entered. Can I do this somehow?--
bozrdang
------------------------------------------------------------------------
bozrdang's Profile: www.excelforum.com/member.php...oamp;userid=34463
View this thread: www.excelforum.com/showthread...hreadid=542243Do you mean a column header on a sprdsht? If yes a formula will do it:
using your example,
=quot;Part #quot;amp;D6
No, I mean a page header.--
bozrdang
------------------------------------------------------------------------
bozrdang's Profile: www.excelforum.com/member.php...oamp;userid=34463
View this thread: www.excelforum.com/showthread...hreadid=542243Everything I've read by searching this newsgroup
groups.google.com/group/micro...353db9c73db179
....suggests this can only be done with VBA. This link gives an example.You may use the workbook event quot;Before_printquot;. This basic macro will
substitute whatever you have in the center header with the values of the
range A1 on the active sheet:
Private Sub Workbook_BeforePrint(Cancel As Boolean)
ActiveSheet.PageSetup.CenterHeader = Range(quot;A1quot;).Value
End Sub
You can make it as complicate as you want, the event takes place even before
the print preview, so you can see the results before printing.
Hope this helps,
Miguel.
quot;bozrdangquot; wrote:
gt;
gt; No, I mean a page header.
gt;
gt;
gt; --
gt; bozrdang
gt; ------------------------------------------------------------------------
gt; bozrdang's Profile: www.excelforum.com/member.php...oamp;userid=34463
gt; View this thread: www.excelforum.com/showthread...hreadid=542243
gt;
gt;
Thanks guys! That does exactly what I asked, my only problem is that
Since it's a header I need it to be a larger font size and bold. Not
to mention that it was meant to be the 2nd line in 3 lines of text in
the Header. Some brief searching seems to indicate you can't format
text in VBA. My ultimate goal was something like this:
* C o m p a n y N a m e *
PART # 1234 WORK INSTRUCTIONS
::Page 1 of 2::LOL, I must be a high maintenance Office user becasue I dabble a little
bit in both Excel and Access and I invariably end up wanting to do
something that seems relatively simple, but ends up being extremely
difficult to achieve. --
bozrdang
------------------------------------------------------------------------
bozrdang's Profile: www.excelforum.com/member.php...oamp;userid=34463
View this thread: www.excelforum.com/showthread...hreadid=542243Well, VBA may be able to do what you need. The best way of finding out is
recording a macro while you do all the formating that you want to do, and
then look at the code that has been generated. In the line that sets the
CenterHeader you may find the code you are looking for.
Miguel.
quot;bozrdangquot; wrote:
gt;
gt; Thanks guys! That does exactly what I asked, my only problem is that
gt; Since it's a header I need it to be a larger font size and bold. Not
gt; to mention that it was meant to be the 2nd line in 3 lines of text in
gt; the Header. Some brief searching seems to indicate you can't format
gt; text in VBA. My ultimate goal was something like this:
gt;
gt; * C o m p a n y N a m e *
gt; PART # 1234 WORK INSTRUCTIONS
gt; ::Page 1 of 2::
gt;
gt;
gt; LOL, I must be a high maintenance Office user becasue I dabble a little
gt; bit in both Excel and Access and I invariably end up wanting to do
gt; something that seems relatively simple, but ends up being extremely
gt; difficult to achieve.
gt;
gt;
gt; --
gt; bozrdang
gt; ------------------------------------------------------------------------
gt; bozrdang's Profile: www.excelforum.com/member.php...oamp;userid=34463
gt; View this thread: www.excelforum.com/showthread...hreadid=542243
gt;
gt;
Thanks a ton Miguel! I managed to get it to do exactly what I wanted
doing that. I've never played with macros before and I've only played
with VBA in Access so I didn't know you could do that. It's kinda like
building a query in QBE in Access and then looking at the SQL code it
creates. Very handy.
I guess some posts I read elsewhere were incorrect about formatting
text through VBA. At least in a header anyway.
Thanks again Miguel and Dave!--
bozrdang
------------------------------------------------------------------------
bozrdang's Profile: www.excelforum.com/member.php...oamp;userid=34463
View this thread: www.excelforum.com/showthread...hreadid=542243That's a good way of saying it, I have also used QBE to take a look at the
SQL after
I'm glad that it helped,
Miguel.
quot;bozrdangquot; wrote:
gt;
gt; Thanks a ton Miguel! I managed to get it to do exactly what I wanted
gt; doing that. I've never played with macros before and I've only played
gt; with VBA in Access so I didn't know you could do that. It's kinda like
gt; building a query in QBE in Access and then looking at the SQL code it
gt; creates. Very handy.
gt;
gt; I guess some posts I read elsewhere were incorrect about formatting
gt; text through VBA. At least in a header anyway.
gt;
gt; Thanks again Miguel and Dave!
gt;
gt;
gt; --
gt; bozrdang
gt; ------------------------------------------------------------------------
gt; bozrdang's Profile: www.excelforum.com/member.php...oamp;userid=34463
gt; View this thread: www.excelforum.com/showthread...hreadid=542243
gt;
gt;
- Dec 18 Thu 2008 20:48
Can you put a formula in a header?
close
全站熱搜
留言列表
發表留言