Copy paste block with hidden rows

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,004
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
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
17,955
Office Version
2013
Platform
Windows
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
 

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,004
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
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
17,955
Office Version
2013
Platform
Windows
What is the actual formula
 

UHsoccer

Well-known Member
Joined
Apr 3, 2002
Messages
1,004
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
 

Michael M

Well-known Member
Joined
Oct 27, 2005
Messages
17,955
Office Version
2013
Platform
Windows
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 ??
 

Forum statistics

Threads
1,077,617
Messages
5,335,261
Members
399,009
Latest member
twcaddell

Some videos you may like

This Week's Hot Topics

Top