+ Reply to Thread
Results 1 to 6 of 6

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

Hybrid View

maulik1k Macros issues with END... 09-06-2013, 11:15 AM
judgeh59 Re: hi i am looking to get... 09-06-2013, 11:35 AM
maulik1k Re: hi i am looking to get... 09-06-2013, 11:42 AM
judgeh59 Re: hi i am looking to get... 09-06-2013, 12:06 PM
maulik1k Re: hi i am looking to get... 09-06-2013, 01:42 PM
judgeh59 Re: Macros issues with END... 09-06-2013, 02:33 PM
  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.

  2. #2
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: hi i am looking to get this macro to work

    just a few things

    1) the moderators will probably not like the title of your post....it needs to be more descriptive
    2) the moderators will probably tell you to put code tags around the code....IE wrap the word CODE inside [] at the beginning and at the end put /CODE inside []

    now to the fun part....I don't see the beginning of the SUB....something like SUB TESTING() and then an END SUB at the end (which is there)
    also, I believe, for every With there must be an END WITH....not one at the beginning with a whole bunch of WITHs in the middle and one END WITH at the end....

    give that a shot....
    Ernest

    Please consider adding a * if I helped

    Nothing drives me crazy - I'm always close enough to walk....

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

    Re: hi i am looking to get this macro to work

    Hi Thanks for the input I appreciate it. its my first time positing on here so i didnt know wouldnt want to get flagged by the moderators.

  4. #4
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

    Re: hi i am looking to get this macro to work

    not a problem, they are usually pretty cool for nubees.....so did that help on the whole adding END WITH's?

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

    Re: hi i am looking to get this macro to work

    hi judge i almost got it to work it seems to be erroring out in the end but i need just a couple more tweaks and i should have this thing ready to go thanks for your input.

  6. #6
    Forum Expert judgeh59's Avatar
    Join Date
    02-07-2013
    Location
    Boise, Idaho
    MS-Off Ver
    Excel 2016
    Posts
    2,310

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

    I'm glad I could help....

    @Fdibbins - I meant no slight to any MOD....truely I didn't....I did see the though, and I should have put one on mine.....I was guilty early on in my EF life....and justifiably "Noted".....being a MOD can't be easy so, THANKS TO ALL MODS....

+ Reply to Thread

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