Consulting

Results 1 to 3 of 3

Thread: Copy Paste of Filtered data with hidden columns

  1. #1
    VBAX Regular
    Joined
    Feb 2009
    Posts
    35
    Location

    Copy Paste of Filtered data with hidden columns

    Hi

    I have two Sheets with the same table formats. Source Sheet & Destination Sheet. Both Sheets have hidden columns (as I said same tables in both so same columns are hidden).
    In the Source Sheet I filter the data and then select the filtered rows and copy. In the destination sheet I select the first cell and paste.
    The problem is that the data is shifted to the right because of the hidden column. The copy operation copied ONLY the visible columns (without the hidden ones) and The Paste operation pasted it into the hidden columns.

    If I do the same thing without filtering - there is no problem and all columns are copied into the correct place including the hidden ones.

    This is how Excel acts. The question is - Is there a way to copy all columns including hidden (after filtering) or do I need to unhide -> Copy -> hide ?

    Thanks
    Asi

  2. #2
    Knowledge Base Approver VBAX Wizard p45cal's Avatar
    Joined
    Oct 2005
    Location
    Surrey UK
    Posts
    5,876
    Playing with this I've come to the conclusion that the easiest way is temporarily to unhide the Source columns to copy. The destination columns can remain hidden.
    If, as you say, the same columns should be hidden in both sheets, you can restore the hidden columns in the Source sheet by referring to the hidden properties of the columns in the destination sheet with the likes of:
    [vba]For Each c In Sheets("Dest").UsedRange.Columns
    Sheets("Source").Columns(c.Column).Hidden = c.Hidden
    Next c[/vba]
    p45cal
    Everyone: If I've helped and you can't be bothered to acknowledge it, I can't be bothered to look at further posts from you.

  3. #3
    VBAX Regular
    Joined
    Feb 2009
    Posts
    35
    Location
    Thanks for you help

Posting Permissions

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