Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 46
Default hide columns before printing

Hi,

Before actually printing my sheet I want to hide column A and B.
Can I do this automatically without having to hide them manually?

Thanks

--

Mvg.
Jean-Paul De Winter


  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default hide columns before printing

press ALT+F11 to get to VBA
then in Project-VBA Project window double click on ThisWorkbook
put this code into the window to the right:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("A:B").Columns.Entirecolumn.Hidden = True
End Sub


HIH
pls click YES if it helped


On 15 Kwi, 08:24, "Jean-Paul De Winter"
wrote:
Hi,

Before actually printing my sheet I want to hide column A and B.
Can I do this automatically without having to hide them manually?

Thanks

--

Mvg.
Jean-Paul De Winter


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 464
Default hide columns before printing

Define a Custom View.


--
Regards
Dave Hawley
www.ozgrid.com
"Jean-Paul De Winter" wrote in message
...
Hi,

Before actually printing my sheet I want to hide column A and B.
Can I do this automatically without having to hide them manually?

Thanks

--

Mvg.
Jean-Paul De Winter



  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default hide columns before printing

???

ozgrid.com wrote:
Define a Custom View.


  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 464
Default hide columns before printing

Read your Excel Help on "Custom Views"


--
Regards
Dave Hawley
www.ozgrid.com
"Jean-Paul" wrote in message
...
???

ozgrid.com wrote:
Define a Custom View.



  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 12
Default hide columns before printing

Hi,

Thanks for the code, it works, but, after printing and returning to the
worksheet, both columns remain hidden..
How can I automatically make them visible again??

Thanks

Jarek Kujawa wrote:
press ALT+F11 to get to VBA
then in Project-VBA Project window double click on ThisWorkbook
put this code into the window to the right:

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Range("A:B").Columns.Entirecolumn.Hidden = True
End Sub


HIH
pls click YES if it helped


On 15 Kwi, 08:24, "Jean-Paul De Winter"
wrote:
Hi,

Before actually printing my sheet I want to hide column A and B.
Can I do this automatically without having to hide them manually?

Thanks

--

Mvg.
Jean-Paul De Winter


  #7   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 896
Default hide columns before printing

Jean_Paul's and Dave's solution is better

but if you prefer to stick with VBA then you might use this one (which
is far from perfect):

Sub Makro1()

For i = 1 To ActiveWindow.SelectedSheets.Count
names_string= names_string & Sheets(i).Name
Next i

If names_string Like "*Sheet1*" Then Arkusz1.Columns("A:B").Hidden =
True

ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True

If names_string Like "*Sheet1*" Then Arkusz1.Columns("A:B").Hidden =
False

End Sub

adjust your sheet names and columns

On 17 Kwi, 00:35, Jean-Paul wrote:
Hi,

Thanks for the code, it works, but, after printing and returning to the
worksheet, both columns remain hidden..
How can I automatically make them visible again??

Thanks



Jarek Kujawa wrote:
press ALT+F11 to get to VBA
then in Project-VBA Project window double click on ThisWorkbook
put this code into the window to the right:


Private Sub Workbook_BeforePrint(Cancel As Boolean)
* * *Range("A:B").Columns.Entirecolumn.Hidden = True
End Sub


HIH
pls click YES if it helped


On 15 Kwi, 08:24, "Jean-Paul De Winter"
wrote:
Hi,


Before actually printing my sheet I want to hide column A and B.
Can I do this automatically without having to hide them manually?


Thanks


--


Mvg.
Jean-Paul De Winter- Ukryj cytowany tekst -


- Pokaż cytowany tekst -


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
Hide row before printing Greg Excel Discussion (Misc queries) 3 October 29th 09 03:32 PM
Want to Hide columns in spreadsheet but NOT hide data in chart. KrispyData Charts and Charting in Excel 1 March 20th 09 04:45 PM
Hide / Unhide columns for Printing Ripper Excel Discussion (Misc queries) 1 April 16th 08 10:43 PM
Hide Text When Printing Erika Excel Discussion (Misc queries) 1 May 18th 07 10:00 PM
Is there a way to hide text from printing Wayne hof Excel Discussion (Misc queries) 4 February 22nd 06 08:11 PM


All times are GMT +1. The time now is 11:29 PM.

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"