Copy paste block with hidden rows

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,023
I need to add code to a macro to copy and paste a block of cells that include hidden rows of data, sample code

Selection.SpecialCells(x1CelltypeVisible).Select
Copy Range(A4:B10).select
Application.CutCopyMode=False
Range(A4:B10).select
Selection.PasteSpecial Paste:=x1PasteValues, Operation:=x1None, SkipBlanks := False, Transpose:=False
Application.CutCopyMode:=False

Error is:
Fails because copy and paste areas are not the same size
 

Excel Facts

Ambidextrous Undo
Undo last command with Ctrl+Z or Alt+Backspace. If you use the Undo icon in the QAT, open the drop-down arrow to undo up to 100 steps.
So, your just copying a block of data and replacing it with values only ??

Code:
Sub MM1()
With Range("A4:B10")
    .Value = .Value
End With
End Sub
 
Upvote 0
Wow, that is simple beyond believe

A second issue is to place formulas in a specific range

Same copy
Form1 = rc[-748]
Range("A4") =Form1

Range("a5:a10).select
Selection.PasteSpecial Paste:=x1PasteFormulas, Operation:=x1None, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode:=False
 
Upvote 0
The formulas are all referencing a column of order data
There are 12 locations and about 18000 rows of items
When orders are entered for a location, I need to update several summary columns
Henry the formulas for given column are all like
Formula = rc[-748]
Next summary location like
Formula = rc[-722]
etc
The problem is that there are probably over a million formulas, but when orders are entered for a specific location, those that reference other locations are not needed
It slows the program down big time
Hence my need to remove them when they are not needed

Sorry for the lengthy answer, but hope it explains my problem
 
Upvote 0
Range("a5:a10).select
Selection.PasteSpecial Paste:=x1PasteFormulas, Operation:=x1None, SkipBlanks:=False, Transpose:=False
Application.CutCopyMode:=False

By the piece of code you provided, you only need 5 formulas, in range ("A5:A10").
So what formulas are they ??
 
Upvote 0

Forum statistics

Threads
1,224,823
Messages
6,181,176
Members
453,021
Latest member
Justyna P

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