Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Hiding Columns

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Hiding Columns

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

"Squid" wrote in message
news:CWPkd.496469$mD.389336@attbi_s02...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,885
Default Hiding Columns

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

--
Regards
Frank Kabel
Frankfurt, Germany

"Squid" schrieb im Newsbeitrag
news:CWPkd.496469$mD.389336@attbi_s02...
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



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2
Default Hiding Columns

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

"Paul B" wrote in message
...
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

"Squid" wrote in message
news:CWPkd.496469$mD.389336@attbi_s02...
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





  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 709
Default Hiding Columns

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

"Squid" wrote in message
news:j4Rkd.76724$HA.33074@attbi_s01...
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

"Paul B" wrote in message
...
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

"Squid" wrote in message
news:CWPkd.496469$mD.389336@attbi_s02...
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







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
hiding columns [email protected] Excel Discussion (Misc queries) 3 July 12th 06 04:42 PM
Hiding columns Adam Excel Discussion (Misc queries) 2 March 31st 05 05:07 PM
Hiding columns scottwilsonx[_10_] Excel Programming 4 July 26th 04 01:23 PM
Not Hiding Columns SS[_3_] Excel Programming 1 February 11th 04 10:27 PM
Hiding columns in VB Rick B[_4_] Excel Programming 6 November 12th 03 07:22 PM


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