Results 1 to 6 of 6

Macros issues with END WITH's/ END SUB's

Threaded View

  1. #1
    Registered User
    Join Date
    09-05-2013
    Location
    New York, USA
    MS-Off Ver
    Excel 2010
    Posts
    21

    Macros issues with END WITH's/ END SUB's

    Hi i am a novice and i am looking to get this macro to work; however, i get an error in the end saying " compile error: end with or end sub "

    thanks,

    Maulik.


    '
        Sheets("Large MBS Diff").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
            IgnorePrintAreas:=False
        ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME").CurrentPage = _
            "(All)"
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME")
            .PivotItems("SBA").Visible = True
            .PivotItems("CMBS Only").Visible = False
            .PivotItems("MBS").Visible = False
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "SBA trader marks vs. other pricing sources"
        
        Dim LastRow As Long
        With ActiveSheet
            LastRow = .Cells(.Rows.Count, "N").End(xlUp).Row
            .PageSetup.PrintArea = "A1:N" & LastRow
        ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
            IgnorePrintAreas:=False
        ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME").CurrentPage = _
            "(All)"
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME")
            .PivotItems("Munis").Visible = True
            .PivotItems("SBA").Visible = False
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "Municipal Bond trader marks vs. other pricing sources"
        
        
        With ActiveSheet
            LastRow = .Cells(.Rows.Count, "N").End(xlUp).Row
            .PageSetup.PrintArea = "A1:N" & LastRow
        ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
            IgnorePrintAreas:=False
        ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME").CurrentPage = _
            "(All)"
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME")
            .PivotItems("Emerging Markets").Visible = True
            .PivotItems("Munis").Visible = False
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "EM trader marks vs. other pricing sources"
        
        
        With ActiveSheet
            LastRow = .Cells(.Rows.Count, "N").End(xlUp).Row
            .PageSetup.PrintArea = "A1:N" & LastRow
        ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
            IgnorePrintAreas:=False
        ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME").CurrentPage = _
            "(All)"
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME")
            .PivotItems("US IG").Visible = True
            .PivotItems("US HY").Visible = True
            .PivotItems("Emerging Markets").Visible = False
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "Corporate Bonds trader marks vs. other pricing sources"
        
        
        With ActiveSheet
            LastRow = .Cells(.Rows.Count, "N").End(xlUp).Row
            .PageSetup.PrintArea = "A1:N" & LastRow
        ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
            IgnorePrintAreas:=False
        ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME").CurrentPage = _
            "(All)"
        With ActiveSheet.PivotTables("PivotTable1").PivotFields("NAME")
            .PivotItems("MBS").Visible = True
            .PivotItems("CMBS Only").Visible = True
            .PivotItems("US IG ").Visible = False
            .PivotItems("US HY").Visible = False
        End With
        Range("A2").Select
        ActiveCell.FormulaR1C1 = "MBS trader marks vs. other pricing sources"
        
        Sheets("MDGT marks").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=2, Collate:=True, _
            IgnorePrintAreas:=False
           
    End Sub
    Moderators note: code tags added for you - this time
    Last edited by maulik1k; 09-06-2013 at 01:29 PM.

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Macro Doesn't Work Through Button, Does Work Through Developer ->Macros Option
    By freybe06 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 06-27-2013, 11:55 AM
  2. [SOLVED] How to make the macro work for all rows in the work sheet
    By Valli nayaki in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-18-2013, 10:43 PM
  3. MAcro does not work when certain cells in a work sheet are protected
    By Unnati in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-10-2012, 03:38 AM
  4. Macro to collate data from different work books and different work sheets
    By bvdileep in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 06-04-2012, 05:34 AM
  5. Replies: 2
    Last Post: 07-11-2006, 11:15 PM

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