Hi Soniya,
This should do it
Private Sub Workbook_BeforePrint(Cancel As Boolean)
Dim aryWidths(1 To 13)
Dim nRow As Double
Dim i As Long
With ActiveSheet
Application.EnableEvents = False
Application.ScreenUpdating = False
For i = 1 To 13
aryWidths(i) = .Columns(i).ColumnWidth
.Columns(i).ColumnWidth = 10
Next i
nRow = .Rows(1).RowHeight
.Rows(1).RowHeight = 20
Cancel = True
.PrintPreview
.Rows(1).RowHeight = nRow
For i = 1 To 13
.Columns(i).ColumnWidth = aryWidths(i)
Next i
Application.ScreenUpdating = True
Application.EnableEvents = True
End With
End Sub
'This is workbook event code.
'To input this code, right click on the Excel icon on the worksheet
'(or next to the File menu if you maximise your workbooks),
'select View Code from the menu, and paste the code
--
HTH
RP
(remove nothere from the email address if mailing direct)
wrote in message
ups.com...
Hi all,
Is it possible to change the row height and column width of a range in
a sheet when the user Print the sheet and return it back to the
original state?
like for eg. when the user executes the print command change the row
hight to 20 and column width to 10 on my range A1:M20 and return it to
what ever width and height was it previously.
TIA
Soniya
|