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,975
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,975
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,975
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,078,437
Messages
5,340,277
Members
399,361
Latest member
Linford

Some videos you may like

This Week's Hot Topics

  • Problem with Radio Button's format control
    I am creating an employee evaluation template (a sample is below) Column A is the category Column B, C D, E and F will be ratings (unacceptable...
  • Last Display on userform to a Listbox
    [CODE=vba] lstdisplay.ColumnCount = 15 lstdisplay.RowSource = "A1:O600000" [/CODE] So when i do this it Displays everything on the sheet i am...
  • Rename and move files to a new location
    Dear all, I have an excel file with the following information. The actual file name is at column A but i want to rename it using the following...
  • Help with True/False Formula
    Hello! Am stumped how to fix this formula, in which my result returns 'True', but it should return False. =IF(AG2=True...
  • Clear extra characters from a provided range of cells
    Dear All, I have following code which gives me desired output to remove extra characters from a provided range. But it takes too much time when...
  • Help with Current and highest streaks
    Hi there, I've just joined the forum and this is my first post. I've already spent quite a bit of time searching the net and this forum for a...
Top