Selecting columns to print in Google Sheets via VBA?

TAPS_MikeDion

Well-known Member
Joined
Aug 14, 2009
Messages
622
Office Version
  1. 2011
Platform
  1. MacOS
Hi everybody,
What I am looking to do isn't as simple as the Thread Title may sound. Is it possible to use VBA to select specific columns (A - L, using the values from row 1, i.e. Last Name, First Name, etc) to print.

For example:
I have columns with peoples names, ID numbers, addresses, DOB, etc that go from column A to column L (12 columns in all.)
However, I may only want / need to print the data from a total of 5 columns, but the columns I may need to print aren't always the same. I can't manually go from column-to-column and select the columns, then print and select active cells, because it only goes by the last column I select.

I'm hoping to be able to use VBA to allow me to select only the columns I need to print, like so...

A
B
C
D
E
F
1
Last Name
First Name
Middle Name
ID Number
Street Address
City
2SmithJoeWilliam90123 This StreetChicago

What I'd like to know is if there's a way to choose from a list of column headers (example: Last Name, First Name, ID Number only) and then print just those columns (A, B & D.)

Thank you SO MUCH if you come up with a solution to this problem!

-Mike
 

Excel Facts

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
Google sheets doesn't support VBA, it uses Apps Script
 
Upvote 0
Solution
Ugh. So Apps Script cannot be written like VBA then? I don't know Apps Script and I know only the basics when it comes to VBA.

Thank you for your response, by the way.
 
Upvote 0

Forum statistics

Threads
1,223,886
Messages
6,175,191
Members
452,616
Latest member
intern444

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