Copying to clipboard from hidden columns – help!

RusselJ

Board Regular
Joined
Aug 5, 2013
Messages
155
Hi All

I am trying to copy the range X59:AC71 to the clipboard but columns X:AF are hidden.

I have tried to toggle the hidden status of the columns as below but for some reason the data is not copied properly and will not paste.

It works fine if I don’t rehide the columns after the copy.

Sub CopyIt()
Dim sh As Worksheet
Set sh = ActiveWorkbook.Sheets("Reserves")
Range("X:AF").EntireColumn.Hidden = False
sh.Range("X59:AC71").Copy
Range("X:AF").EntireColumn.Hidden = True
End Sub

Please can someone advise how I can achieve this?

Thanks

Russel
 

Excel Facts

Waterfall charts in Excel?
Office 365 customers have access to Waterfall charts since late 2016. They were added to Excel 2019.
I think you will find that may be difficult to achieve.

Alternatively, you might consider putting the "hidden" copy range in a new sheet and just hide that sheet. You could then perform your copy on the range in the hidden sheet, which would not have columns widths of zero length, and allow the user to paste as they please...
 
Upvote 0

Forum statistics

Threads
1,203,602
Messages
6,056,213
Members
444,850
Latest member
dancasta7

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