Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel: some cells don't print 1

Status
Not open for further replies.

hopelessliar

Technical User
Apr 29, 2002
89
GB
This one has me stumped. 3 cells (which are merged cells) don't print along with the rest of the sheet. They aren't hidden, autofilter is not involved and the colours/ fonts are the same as other cells that do print. The only difference is that they are merged.

Any ideas?
 
Perhaps by merging the cells, it is now outside of your print range?

Go to View, Page Break Preview. Areas in white will print,anything shaded will not be printed... to fix you need to drag the blue bar.

Hope it's something simple like this!

Jan
 
luc,

It appears that the 3 merged cells indeed could somehow be the cause of the problem.

An alternative to using "merged" cells, is to use "Center-Across-Columns" - which will leave you with the same appearance. This can be a potential solution for your immediate problem.

In addition, there can be additional benefits to using this option.

a) not having your cursor "jump" to a different column when you move your cursor over merged cells.

b) not having to deal with problems when attempting to copy merged cells from one place to another.

Using Center Across Columns is found under: Format Cells - Alignment - Horizontal - Center Across Selection. Using this menu option can be a real "pain" in terms of the number of "clicks" required.

By comparison, I only have to:

a) highlight the range - by holding down <Shift> and using the <Right-Arrow> key, and

b) hold down the (left) <Alt> key and hit &quot;A&quot; (using one hand)

To my knowledge, there is no &quot;built-in&quot; keyboard shortcut for the above Center-Across-Selection. Therefore, I had to create my own. This is fairly easy. Here are the steps...

1) From the menu, choose: Tools - Customize

2) Click on the &quot;Commands&quot; tab.

3) Scroll down under &quot;Categories&quot; (on the left) and click on &quot;Macros&quot;.

4) Under &quot;Commands&quot; (right side), click-and-drag the &quot;Custom Button&quot; to one of your existing toolbars.

5) While still in &quot;Customize&quot;, right-click on the &quot;Custom Button&quot; icon (a happy-face).

6) In the drop-down, click in the &quot;Name&quot; box (3rd from top) and replace &quot;&Custom Button&quot; with &quot;&Align&quot; (or if your toolbar is really full, all you really need is &quot;&A&quot;.

7) While still in &quot;Customize&quot;, right-click on your revised Custom Button and choose &quot;Text Only (Always)&quot;.

8) The &quot;bottom&quot; item on the &quot;Customize&quot; pull-down, is &quot;Assign Macro&quot;. However, before you can assign your custom macro, you need to create it... as follows...

9a) In a new workbook, hold down <Alt> and hit <F11> to bring up the &quot;Visual Basic Editor&quot; window.

9b) If you can only see one window in the Visual Basic Editor, pick from the menu: View - Project Explorer.

9c) Under Project Explorer (on the left) click on your PERSONAL.XLS file. Insert a Module by using from the menu: Insert - Module.

9d) Hold down <Alt> and hit <Tab> to go to the Tek-Tips window. Highlight the following code, and copy it, using <Control> C

Sub AlignAcrossColumns()
With Selection
.HorizontalAlignment = xlCenterAcrossSelection
.WrapText = False
End With
End Sub

9e) Hold down <Alt> and hit <Tab> to go back to Excel.

9f) In the Visual Basic Editor (right side), paste the code, using <Control> V.

9g) Reminder: When you exit out of Excel, be sure to SAVE your Personal.xls workbook.

10) Now you're ready to resume where you left off - with Step 8). Go back to Tools - &quot;Customize&quot;, and right-click on your custom icon.

11) Now choose &quot;Assign Macro&quot;, and pick the macro you have just previously copied. Click OK and you're done.

Now to test your macro, enter text into a cell - on the left edge of the area where you want it centered. Hold down the <Shift> key, and move the cursor to the right, using the <Right-Arrow> key. Once you've highlighted the cells, hold down the <Alt> key, and hit &quot;A&quot;.

I hope the helps. I'm confident that after you use this option, you come to appreciate it as a good alternative to always having to merge cells.

Regards, ...Dale Watson dwatson@bsi.gov.mb.ca
 
Thanks for that Dale, I think I will implement that as an alternative to merged cells - altogether neater.

Excellent idiot's guide to the process too!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top