Results 1 to 6 of 6

Thread: Copy paste block with hidden rows
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    Board Regular
    Join Date
    Apr 2002
    Location
    South Bend, IN
    Posts
    1,004
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Copy paste block with hidden rows

    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 2003 and 2010 on 64bit Windows-7

  2. #2
    Board Regular Michael M's Avatar
    Join Date
    Oct 2005
    Location
    South Western NSW
    Posts
    17,894
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Copy paste block with hidden rows

    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
    Regards
    Michael M
    ---------------------------------------
    The more I learn, the less I seem to know.....A Please and Thank You cost nothing !
    It's easier to debug if we can see the whole macro !
    Home 2007 & 2013

    - Posting guidelines, forum rules and terms of use

    - To download Mr Excel HTML Maker

    - Try searching for your answer first, see how

    - Read the FAQs

    - List of BB codes


    [CODE]Place Your Code Here[/CODE]

  3. #3
    Board Regular
    Join Date
    Apr 2002
    Location
    South Bend, IN
    Posts
    1,004
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Copy paste block with hidden rows

    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

  4. #4
    Board Regular Michael M's Avatar
    Join Date
    Oct 2005
    Location
    South Western NSW
    Posts
    17,894
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Copy paste block with hidden rows

    What is the actual formula

  5. #5
    Board Regular
    Join Date
    Apr 2002
    Location
    South Bend, IN
    Posts
    1,004
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: Copy paste block with hidden rows

    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

  6. #6
    Board Regular Michael M's Avatar
    Join Date
    Oct 2005
    Location
    South Western NSW
    Posts
    17,894
    Post Thanks / Like
    Mentioned
    18 Post(s)
    Tagged
    2 Thread(s)

    Default Re: Copy paste block with hidden rows

    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 ??
    Regards
    Michael M
    ---------------------------------------
    The more I learn, the less I seem to know.....A Please and Thank You cost nothing !
    It's easier to debug if we can see the whole macro !
    Home 2007 & 2013

    - Posting guidelines, forum rules and terms of use

    - To download Mr Excel HTML Maker

    - Try searching for your answer first, see how

    - Read the FAQs

    - List of BB codes


    [CODE]Place Your Code Here[/CODE]

Some videos you may like

User Tag List

Tags for this Thread

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •