VBA Array copying of formats

jwk

New Member
Joined
Sep 9, 2011
Messages
4
I am producing a condensed version of a report, reducing the number of columns from around 500 to around 100. I am doing this by capturing the entire range as an array, then passing only the columns I want to a new array and outputing back to worksheet. Very Fast for the data.

However, I also would like to bring in the column formatting --fonts, colors, etc. from the original columns. So I would like to essentially delete the columns I don't want, without explicitly deleting them -- this is way too slow.

Ideas for bringing in the formatting from the original column, or 're-attaching' the formatting back to the data?

I'm a big fan of array processing...

Thanks -- and looking forward to the collective brainpower being harnessed here!
 

Excel Facts

Do you hate GETPIVOTDATA?
Prevent GETPIVOTDATA. Select inside a PivotTable. In the Analyze tab of the ribbon, open the dropown next to Options and turn it off
Hi there,

Not tried, but I would think that trying to save the various formatting properties and re-apply them to the destination columns would be slow, no?

If you know which columns you are deleting, you can do so in a non-continguous fashion:
Code:
    Range("B:C,E:H,J:L,N:O").Columns.Delete
 
Upvote 0
Thanks GTO -- I'm about to embark on looping through every cell in the range --hopefully via an array -- and capturing the formatting, then re-applying -- to see how fast it may be.

I've played with your array of columns method, but it has not worked well; I keep getting overlapping range errors, maybe due to the fact there are merged cells that make the column selections less exact.
 
Upvote 0
Thanks GTO -- I'm about to embark on looping through every cell in the range --hopefully via an array -- and capturing the formatting, then re-applying -- to see how fast it may be.

I've played with your array of columns method, but it has not worked well; I keep getting overlapping range errors, maybe due to the fact there are merged cells that make the column selections less exact.

:eeek:The bane of worksheets!:eeek:

Just curious, wouldn't you be unmerging them at some time anyway?
 
Upvote 0

Forum statistics

Threads
1,224,564
Messages
6,179,548
Members
452,927
Latest member
rows and columns

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