Results 1 to 6 of 6

can only copy/select visible cells w autofilter on &hidden columns, want to copy all cells

Threaded View

  1. #1
    Registered User
    Join Date
    11-05-2011
    Location
    California
    MS-Off Ver
    Excel 2007
    Posts
    56

    can only copy/select visible cells w autofilter on &hidden columns, want to copy all cells

    It is only copying/selecting the visible cells. I want to copy the entire range, hidden and visible cells alike or select the entire range.

    My worksheet has autofilter on and hidden columns & I have the following vba macro that inserts rows then copies the range "workpack" and pastes it into the newly inserted rows and a macro that deletes all values on the etc forecast line

    However, if any filters are applied, when the macro is executed it doesn't behave as i want it to. Instead of copying the entire range like i want, it only copies the visible cells and pastes it in as values.

    Please see the attached workbook. Execute the code by either clicking the button or hitting ctrl + shift + z. You will see what i mean. Set the filter so no filters are applied and then try running the macro again & it works properly as intended

    Sub insertwp()
        ActiveCell.Offset(6, 0).Rows("1:6").EntireRow.Select
        Selection.Insert Shift:=xlDown
        Range("workpack").Copy
        ActiveCell.Select
        ActiveSheet.Paste
        ActiveCell.Select
        ActiveCell = "Enter Lookup Here"
    End Sub
    Sub resetetc()
        ActiveCell.Offset(4, 3).Range("A1:DL1").Select
        Selection.ClearContents
        ActiveCell.Offset(-4, -3).Range("A1").Select
    End Sub
    I tried
    Range("Workpack").Entirerow.copy
    but it still only copied visible cells

    I am trying to avoid turning off autofilter as that triggers a recalc on my main sheet and the user has to reapply their filters and i am trying to avoid unhiding columns

    So how can i get excel to copy/select the entire range or all cells in the defined range, hidden and visible.

    is there some code similar to below that will do what I want

    Range("Workpack").All.Copy/select
    or
    Range("Workpack").Entirerange.Copy/select

    EDIT: MARKING THIS AS SOLVED

    See this thread for solution to this problem:
    http://www.excelforum.com/excel-prog...09#post2802409




    thanks
    Attached Files Attached Files
    Last edited by JTwrk; 06-08-2012 at 04:49 PM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1