ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Unhiding columns (https://www.excelbanter.com/excel-programming/302688-unhiding-columns.html)

Ian Coates[_3_]

Unhiding columns
 
I have a spreadsheet with more columns than need printing. I can hide these
using Workbook_BeforePrint.

I can not find a way to automatically Unhide these columns after printing or
closing Print Preview.

Can anyone offer a suggestion?

--

Remove NG from my address to send direct.
-----



Bob Flanagan

Unhiding columns
 
You could set an ontime macro to run a few seconds after the printing
starts, and include the code in the beforeprint event:

Application.OnTime (Now() + TimeSerial(0, 0, 3)), "ShowColumns"

and in a regular module:

Sub ShowColumns
Cells.EntireColumn.Hidden = False
end sub

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
..

"Ian Coates" wrote in message
news:RNTDc.69$Ik4.39@newsfe3-gui...
I have a spreadsheet with more columns than need printing. I can hide

these
using Workbook_BeforePrint.

I can not find a way to automatically Unhide these columns after printing

or
closing Print Preview.

Can anyone offer a suggestion?

--

Remove NG from my address to send direct.
-----





Ian Coates[_3_]

Unhiding columns
 
Thanks Bob

I'm not familiar with this procedure. Presumably it relies on the print
staring before the macro runs. How would this work if Print Preview is
selected first? The columns are hidden in the preview, but if the macro runs
before Print is selected, what would happen?

--

Remove NG from my address to send direct.
-----

"Bob Flanagan" wrote in message
...
You could set an ontime macro to run a few seconds after the printing
starts, and include the code in the beforeprint event:

Application.OnTime (Now() + TimeSerial(0, 0, 3)), "ShowColumns"

and in a regular module:

Sub ShowColumns
Cells.EntireColumn.Hidden = False
end sub

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
.

"Ian Coates" wrote in message
news:RNTDc.69$Ik4.39@newsfe3-gui...
I have a spreadsheet with more columns than need printing. I can hide

these
using Workbook_BeforePrint.

I can not find a way to automatically Unhide these columns after

printing
or
closing Print Preview.

Can anyone offer a suggestion?

--

Remove NG from my address to send direct.
-----







Tom Ogilvy

Unhiding columns
 
If printpreview is active, then I don't believe it would run. OnTime is not
preemptive.

See Chip Pearson's page on Ontime and consult the excel VBA help for
information on making ONTime "wait"

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy

"Ian Coates" wrote in message
news:QrUDc.78$Ik4.59@newsfe3-gui...
Thanks Bob

I'm not familiar with this procedure. Presumably it relies on the print
staring before the macro runs. How would this work if Print Preview is
selected first? The columns are hidden in the preview, but if the macro

runs
before Print is selected, what would happen?

--

Remove NG from my address to send direct.
-----

"Bob Flanagan" wrote in message
...
You could set an ontime macro to run a few seconds after the printing
starts, and include the code in the beforeprint event:

Application.OnTime (Now() + TimeSerial(0, 0, 3)), "ShowColumns"

and in a regular module:

Sub ShowColumns
Cells.EntireColumn.Hidden = False
end sub

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
.

"Ian Coates" wrote in message
news:RNTDc.69$Ik4.39@newsfe3-gui...
I have a spreadsheet with more columns than need printing. I can hide

these
using Workbook_BeforePrint.

I can not find a way to automatically Unhide these columns after

printing
or
closing Print Preview.

Can anyone offer a suggestion?

--

Remove NG from my address to send direct.
-----









Ian Coates[_3_]

Unhiding columns
 
Many thanks to Tom and Bob. It's working a treat.

--

Remove NG from my address to send direct.
-----

"Tom Ogilvy" wrote in message
...
If printpreview is active, then I don't believe it would run. OnTime is

not
preemptive.

See Chip Pearson's page on Ontime and consult the excel VBA help for
information on making ONTime "wait"

http://www.cpearson.com/excel/ontime.htm

--
Regards,
Tom Ogilvy

"Ian Coates" wrote in message
news:QrUDc.78$Ik4.59@newsfe3-gui...
Thanks Bob

I'm not familiar with this procedure. Presumably it relies on the print
staring before the macro runs. How would this work if Print Preview is
selected first? The columns are hidden in the preview, but if the macro

runs
before Print is selected, what would happen?

--

Remove NG from my address to send direct.
-----

"Bob Flanagan" wrote in message
...
You could set an ontime macro to run a few seconds after the printing
starts, and include the code in the beforeprint event:

Application.OnTime (Now() + TimeSerial(0, 0, 3)), "ShowColumns"

and in a regular module:

Sub ShowColumns
Cells.EntireColumn.Hidden = False
end sub

Bob Flanagan
Macro Systems
Delaware, U.S. 302-234-9857
http://www.add-ins.com
Productivity add-ins and downloadable books on VB macros for Excel
.

"Ian Coates" wrote in message
news:RNTDc.69$Ik4.39@newsfe3-gui...
I have a spreadsheet with more columns than need printing. I can

hide
these
using Workbook_BeforePrint.

I can not find a way to automatically Unhide these columns after

printing
or
closing Print Preview.

Can anyone offer a suggestion?

--

Remove NG from my address to send direct.
-----












All times are GMT +1. The time now is 03:32 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com