+ Reply to Thread
Results 1 to 2 of 2

Page setup macro

Hybrid View

  1. #1
    Forum Contributor
    Join Date
    01-28-2007
    MS-Off Ver
    2019
    Posts
    205

    Page setup macro

    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

  2. #2
    Forum Contributor
    Join Date
    01-28-2007
    MS-Off Ver
    2019
    Posts
    205

    Re: Page setup macro

    reading the post not sure if i explained it correctly

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1