Select and copy multiple columns - but only the visible columns

SteynBS

Board Regular
Joined
Jun 27, 2022
Messages
104
Office Version
  1. 365
Platform
  1. Windows
Good day guys.

I have built a working sheet to ease single-column uploads - I want to progress to upload multiple columns but ignore blank or hidden ones.

The sheet works as follow:
1674131244511.png


Once the changes are entered into column C I have a vba that opens up a blank workbook and copies Columns (A5:C) with this code: Range("A5:C" & lr).Copy

Now I want to copy multiple columns but only the visible ones

1674131809119.png


Not all the columns will be utilized. for example maybe only Column C and E will be used. All the other columns except A,B,C,E needs to be copied. The others will be hidden manually (or if you have a suggestion other than manually hiding the columns not in use - I am all ears)

Please help me with a code to copy Column A,B and the orange colmns that will be in use
 
I replicated your exact same setup by creating a table, adding command buttons and filtering the rows and hiding the columns. I still got the right result without altering the code. Maybe other people can help you.
You can download my workbook from the link below if you want to salvage something out of it.
 

Attachments

  • 1674480243639.png
    1674480243639.png
    74 KB · Views: 4
Upvote 0
Solution

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
I replicated your exact same setup by creating a table, adding command buttons and filtering the rows and hiding the columns. I still got the right result without altering the code. Maybe other people can help you.
You can download my workbook from the link below if you want to salvage something out of it.
I selected the range from the table header up to the last row - it caused the issue. I tried selecting the entire column from A to the last visible column and it worked.

Thank you for your assistance I really do appreciate your time and effort.
 
Upvote 0

Forum statistics

Threads
1,215,029
Messages
6,122,757
Members
449,094
Latest member
dsharae57

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