Hiding Columns

  • Thread starter Thread starter Squid
  • Start date Start date
S

Squid

I have a spreadsheet where I recreated a standard form my company uses.
Therefore I needed to merged some rows. There is one column that I would
like to hide from being printed.

If I manually highlight column K, (right click) click Hide. It hides just
column K. no problem.

But if I when use the following code in the BeforePrint event it will hide
more than just column K, I assume because there rows within column K that
are merged.

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Columns("K:K").Select
Selection.EntireColumn.Hidden = True
End Sub

Any suggestions?

TIA
Mike
 
Squid, try it without selecting it, like this
Columns("K:K").EntireColumn.Hidden = True

--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
 
Hi
if you have merged cells I don't think you can do something against it.
Not tested but try:
range("K1").entirecolumn.hidden=true
 
I figured it out. You must select a cell that is in column K and is not
part of a merged cell. Such as:

Range("K11").Select
Selection.EntireColumn.Hidden = True
 
Squid, tested in 2003 and this also works, with merge cells from J:L it only
hides K
Columns("K:K").EntireColumn.Hidden = True
--
Paul B
Always backup your data before trying something new
Please post any response to the newsgroups so others can benefit from it
Feedback on answers is always appreciated!
Using Excel 2000 & 2003
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top