ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Before_Print (https://www.excelbanter.com/excel-programming/383097-before_print.html)

Robin Clay

Before_Print
 
Greetings !

Would anyone have some idea why this don't work - please ?

Private Sub App_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As Boolean)
For Each wk In Wb.Worksheets
wk.Calculate
If wk.Name = "DATA - ALL" Then
Range("F12").ColumnWidth = 100
End If
Next
End Sub

Mike

Before_Print
 
Try this

Private Sub Workbook_BeforePrint(Cancel As Boolean)
Application.Calculation = xlCalculationAutomatic
Dim wks As Worksheet
For Each wks In ActiveWorkbook.Worksheets
If wks.Name = "DATA - ALL" Then
Range("F12").ColumnWidth = 100
End If
Next wks
End Sub

"Robin Clay" wrote:

Greetings !

Would anyone have some idea why this don't work - please ?

Private Sub App_WorkbookBeforePrint(ByVal Wb As Workbook, Cancel As Boolean)
For Each wk In Wb.Worksheets
wk.Calculate
If wk.Name = "DATA - ALL" Then
Range("F12").ColumnWidth = 100
End If
Next
End Sub


Robin Clay

Before_Print
 
"Mike" wrote:

Try this


Thank you for your response - but it wasn't the "calculate" that was the
problem, it was the "column width".

My fault, sorry !


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

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