LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 413
Default Continuing print code problem

Yes.
Many thanks.

Regards.

"William" wrote in message
...
Stuart

Does this help?

Sub PrintLayout()
Dim r As Range, c As Range, i As Integer
i = 0
With Sheets("Sheet1")
Set r = .Range("A1:Z1")
For Each c In r
If c.EntireColumn.Hidden = True Then i = i + 1
Next c
If i 8 Then
.PageSetup.Orientation = xlPortrait
Else
.PageSetup.Orientation = xlLandscape
End If
End With
End Sub

--
XL2002
Regards

William


"Stuart" wrote in message
...
| User opens a 15 column workbook, which is to say that
| there is data in all first 15 columns, but not in every cell.
| There is data in row1 for all 15 columns.
|
| They then hide columns E - I inclusive, and I use
| Application.InputBox to catch these columns.
|
| At this point I have LastCol as 15 and I am using this to set
| the print range.
|
| How can I trap the number of columns being hidden, since
| this may help decide whethher to print in portrait or
| landscape, please?
|
| On Error Resume Next
| Set ExclColRng = Application.InputBox("Use the left mouse " & _
| "button with the Control key," & vbNewLine & "to select at least" _
| & " one cell in each column " & vbNewLine & "(or the entire" _
| & ".column), to indicate those" & vbNewLine & "Columns to be" _
| & " hidden. Click OK. when done", Type:=8)
| On Error GoTo 0
|
| and
|
| With ActiveSheet
| ExclColRng.EntireColumn.Hidden = True
| 'Make sure user hasn't hidden col A or £col
| Columns(1).Visible = True
| Columns(£Col).Visible = True
| End With
|
| Any help much appreciated.
|
| Regards.
|
|
|
|
| ---
| Outgoing mail is certified Virus Free.
| Checked by AVG anti-virus system (
http://www.grisoft.com).
| Version: 6.0.505 / Virus Database: 302 - Release Date: 30/07/2003
|
|




---
Outgoing mail is certified Virus Free.
Checked by AVG anti-virus system (http://www.grisoft.com).
Version: 6.0.505 / Virus Database: 302 - Release Date: 30/07/2003


 
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
Print code Very Basic User Excel Discussion (Misc queries) 4 February 25th 10 09:08 PM
Print Code Scott Excel Discussion (Misc queries) 2 September 8th 08 04:36 PM
Excel 2007 lookup problem continuing ... Trish Excel Worksheet Functions 3 August 5th 08 05:46 AM
Print Code Sunday88310 Excel Discussion (Misc queries) 2 August 3rd 07 07:20 AM
Print Code Chey Excel Discussion (Misc queries) 1 April 13th 07 08:18 PM


All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"