Hi the code below allows me to email a report copied from inside the workbook. cmd button 6 emails the report, cmd button 5 write the report. What i need, which i cant get it to do it autofit the "new" report to 1 page tall and wide. I've tried to alter the code by adding
'ActiveSheet.PageSetup
'FitToPagesWide = 1
'.FitToPagesTall = 1 .
to cmd button 5 code but it doesnt work
Private Sub CommandButton5_Click()
' send Macro
' Macro recorded 30/08/2007 by JSmith3
'
'
Sheets("Report").Select
Range("A1:J60").Select
Selection.Copy
Sheets("RESULTS").Select
Workbooks.Add
ActiveSheet.Paste
Application.CutCopyMode = False
ActiveSheet.PageSetup
.FitToPagesWide = 1
.FitToPagesTall = 1
Application.Dialogs(xlDialogSendMail).Show
End Sub
Private Sub CommandButton6_Click()
Dim SRef As String
SRef = UserForm2.ComboBox1.Value
Range("C3").Select
Do Until ActiveCell.Value = SRef
ActiveCell.Offset(1, 0).Select
Loop
Worksheets("Report").Range("C16").Value = ActiveCell.Value
Worksheets("Report").Range("C14").Value = ActiveCell.Offset(0, 1).Value
Worksheets("Report").Range("C18").Value = ActiveCell.Offset(0, -1).Value
Worksheets("Report").Range("C20").Value = ActiveCell.Offset(0, 6).Value
Worksheets("Report").Range("H14").Value = ActiveCell.Offset(0, -2).Value
Worksheets("Report").Range("H16").Value = ActiveCell.Offset(0, 2).Value
Worksheets("Report").Range("H18").Value = ActiveCell.Offset(0, 3).Value
Worksheets("Report").Range("H20").Value = ActiveCell.Offset(0, 4).Value
Worksheets("Report").Range("G33").Value = ActiveCell.Offset(0, 8).Value
Worksheets("Report").Range("C57").Value = ActiveCell.Offset(0, 5).Value
Worksheets("Report").Range("A47").Value = UserForm2.TxtCom
Worksheets("Report").Select
Worksheets("Results").Select
End Sub
Bookmarks