select an already selected range and select a fixed range and save as a pdf

Ratigan1970

New Member
Joined
Jan 22, 2024
Messages
16
Office Version
  1. 2010
Platform
  1. Windows
hi again all in vba land

i have a problem that i cant solve
i have a column (range is row 2 to 103) that is already selected but i need to select column A,B,C as well and save as a pdf.
the selected column changes columns see pics below

many thanks to anyone that can help
 

Attachments

  • pay1.png
    pay1.png
    5.9 KB · Views: 2
  • pay2.png
    pay2.png
    6.5 KB · Views: 3
  • pay3.png
    pay3.png
    6.7 KB · Views: 2

Excel Facts

How to calculate loan payments in Excel?
Use the PMT function: =PMT(5%/12,60,-25000) is for a $25,000 loan, 5% annual interest, 60 month loan.
Try it
VBA Code:
    Dim rngSel As Range
    Dim rwFirst As Long
    Dim rwLast As Long
    
    Set rngSel = Selection
    
    If rngSel.Columns.Count > 1 Then
        rwFirst = rngSel.Row
        rwLast = rngSel.Rows.Count + rngSel.Row - 1
        
        Set rngSel = Union(rngSel, Range(Cells(rwFirst, "A"), Cells(rwLast, "C")))
        
        rngSel.Select
    Else
        MsgBox "Select a range of at least two columns.", vbExclamation
    End If

Artik
 
Upvote 0
Solution

Forum statistics

Threads
1,225,730
Messages
6,186,698
Members
453,369
Latest member
positivemind

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