VBA on Printing

wedzmer

New Member
Joined
Mar 15, 2015
Messages
24
This is the VBA Code I'm working on but it's kinda' limited to what I'm suppose to achieve and also it has certain issues like:

1. The Print Button can only let me choose which array (or section) will be printed at that current set.
2. The Scaling SHOULD change when the Print Button should read the "portrait" section to 76% and the "landscape" section to 56%.

What I want to achieve.

1. The Print Button SHOULD read all the 5 sections at once and render it's specific orientation by printing it all at the same time (CTRL + P)
2. The scaling automatically adjusts for the sections of portrait and landscape to 76% and 56% respectively.


Code:
[/COLOR][COLOR=#333333]Sub PrintArea()[/COLOR]
<code style="margin: 0px; padding: 0px; font-style: inherit;">    Dim MyPrintAreas    As Variant, _
        AreaNum         As Long, _
        Ndx             As Long, _
        Prompt          As String
        
    MyPrintAreas = Array( _
        [COLOR=#FF0000]Array("$d$2:$s$91", xlPortrait), _
        Array("$AA$2:$AP$91", xlPortrait), _
        Array("$BA$2:$BP$91", xlPortrait), _
        Array("$CA$2:$CP$91", xlPortrait), _
        Array("$DA$2:$EZ$112", xlLandscape))
[/COLOR]    
    Prompt = "Select an area to print"
    For Ndx = LBound(MyPrintAreas) To UBound(MyPrintAreas)
        Prompt = Prompt & vbCrLf & vbCrLf & vbTab & Ndx + 1 & vbTab & MyPrintAreas(Ndx)(0)
    Next Ndx
    Ndx = 0
    Ndx = InputBox(Prompt) - 1

    With ActiveSheet.PageSetup
         .PrintArea = ""
        .PrintArea = MyPrintAreas(Ndx)(0)
        .Orientation = MyPrintAreas(Ndx)(1)
    End With </code>[COLOR=#333333]End Sub[/COLOR][COLOR=#333333]



3. If ever Number 1 could not be done, at least the Pop-Up Notice would give me the option to give a name for these sets of Array given above like: 1st Quarter, 2nd Quarter et.

 

Excel Facts

What does custom number format of ;;; mean?
Three semi-colons will hide the value in the cell. Although most people use white font instead.

Forum statistics

Threads
1,214,874
Messages
6,122,036
Members
449,062
Latest member
mike575

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top