Using VBA to paste filtered data with hidden columns to another worksheet with the same hidden columns

Lisa070780

New Member
Joined
Feb 18, 2022
Messages
2
Office Version
  1. 2013
Platform
  1. Windows
I hope you can help me.

I have filtered (by blank) data on a worksheet with hidden columns and I'd like to be able to paste this filtered data (visible cells only) to another worksheet which also contains the same hidden columns (skip the hidden columns).

When I use VBA or try to this manually with 'visible cells' and 'skip blanks' it doesn't work because the data is filtered. It works fine if the data isn't filtered by using 'visible cells' and 'skip blanks'!

This is the code that I'm working with:

Sub PasteAll()
PasteAll Macro
Application.Goto Reference:="xxxx_xxxxx_xxxxx"
Selection.Copy
Sheets("xxxxx xxxxx").Select
Range("A9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("xxxx xxxxx").Range("$A$8:$AS$13000").AutoFilter Field:=45, Criteria1:=""
Application.Goto Reference:="xxxx_xxxx"
Application.CutCopyMode = False
Selection.Copy
Sheets("xxx xxxxx").Select
Range("A9").PasteSpecial (xlPasteValues)
Sheets("xxxx xxxxx").Range("$A$8:$AS$13000").AutoFilter Field:=45
End Sub

Thanks in advance.
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I hope you can help me.

I have filtered (by blank) data on a worksheet with hidden columns and I'd like to be able to paste this filtered data (visible cells only) to another worksheet which also contains the same hidden columns (skip the hidden columns).

When I use VBA or try to this manually with 'visible cells' and 'skip blanks' it doesn't work because the data is filtered. It works fine if the data isn't filtered by using 'visible cells' and 'skip blanks'!

This is the code that I'm working with:

Sub PasteAll()
PasteAll Macro
Application.Goto Reference:="xxxx_xxxxx_xxxxx"
Selection.Copy
Sheets("xxxxx xxxxx").Select
Range("A9").Select
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
:=False, Transpose:=False
Sheets("xxxx xxxxx").Range("$A$8:$AS$13000").AutoFilter Field:=45, Criteria1:=""
Application.Goto Reference:="xxxx_xxxx"
Application.CutCopyMode = False
Selection.Copy
Sheets("xxx xxxxx").Select
Range("A9").PasteSpecial (xlPasteValues)
Sheets("xxxx xxxxx").Range("$A$8:$AS$13000").AutoFilter Field:=45
End Sub

Thanks in advance.
Why don't you just hide the columns in the destination sheet after the paste as part of your code...
 
Upvote 0
Why don't you just hide the columns in the destination sheet after the paste as part of your code...
This wouldn't work for me. The columns to be hidden and visible will change monthly and I don't want to have to continue to change the Macro each month to accommodate this. Thank you for your suggestion.
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,289
Members
452,631
Latest member
a_potato

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