Results 1 to 6 of 6

Printing a Dynamic Range with VBA coding

Threaded View

groundin Printing a Dynamic Range with... 11-25-2012, 04:50 PM
xladept Re: Printing a Dynamic Range... 11-25-2012, 08:02 PM
groundin Re: Printing a Dynamic Range... 11-25-2012, 08:19 PM
xladept Re: Printing a Dynamic Range... 11-25-2012, 08:37 PM
groundin Re: Printing a Dynamic Range... 11-25-2012, 08:52 PM
xladept Re: Printing a Dynamic Range... 11-25-2012, 09:22 PM
  1. #1
    Forum Contributor
    Join Date
    11-25-2012
    Location
    Edmonton, Alberta
    MS-Off Ver
    2010
    Posts
    146

    Printing a Dynamic Range with VBA coding

    I am trying to set up a dynamic print range to print a sheet in a work book that is populated from another sheet in the same workbook. I seem to be having trouble. I set up a named range in Name Manager called lateral as follows:

    =OFFSET('Slide Sheet Print Lateral'!$A$27, 0, 0, COUNTA('Slide Sheet Print Lateral'!$A:$A), COUNTA('Slide Sheet Print Lateral'!$1:$1))

    I can't seem to make that work for some reason.
    I am stuck trying to write the VBA code ( I know nothing about VBA) I have this that I recorded, I have the sheet hidden that I want to print it unhides it and then rehides it.

    Sub PrintSlideSheetLat()
    '
    ' PrintSlideSheet Lateral Macro
    '
    
    '
        Sheets("Slide Sheet Lateral").Select
        Sheets("Slide Sheet Print Lateral").Visible = True
        Sheets("Slide Sheet Print Lateral").Select
        ActiveSheet.PageSetup.Printarea = "lateral" ///ERROR on this line
        ActiveWindow.SmallScroll Down:=-201
        Range("D14").Select
        ActiveWindow.SelectedSheets.PrintOut Copies:=1, Collate:=True, _
            IgnorePrintAreas:=False
        Range("D14").Select
        Sheets("Slide Sheet Lateral").Select
        Range("Q10:S10").Select
        Sheets("Slide Sheet Print Lateral").Select
        ActiveWindow.SelectedSheets.Visible = False
    End Sub
    Basically I want it to print from A through to N if there is a value in Column A if there is no value in A then print up to the line that is blank

    I get an error "Run Time Error '1004'" on
    sorry for all the #REF errors in attachement, had to delete a bunch of pages so it was small enough to upload

    Can anyone help?




    Moderator's Note: Welcome to the forum, don't forget to put code tags on codes, Select the code then Hit the "#" sign. Thank you.
    Attached Files Attached Files
    Last edited by vlady; 11-25-2012 at 08:43 PM. Reason: code tags

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