+ Reply to Thread
Results 1 to 5 of 5

Copying invisible columns, but not invisible rows

  1. #1
    Registered User
    Join Date
    07-31-2008
    Location
    Philadelphia, PA
    Posts
    40

    Copying invisible columns, but not invisible rows

    I'm using the following code, which I figured out quite by accident out of happy coincidence that somebody else on here asked about selecting only visible rows:

    Please Login or Register  to view this content.
    This already makes my life a thousand times easier, but what would be even more ideal is if this line could be modified to copy all of the hidden columns in the "Inventory" range, but none of the hidden rows. The "Inventory" range is fluctuating constantly, but right now refers to the cells D10 to J39, with columns G and I always being hidden (though I want them copied), and with rows 14, 20, 25, 28, 31, 36, and 39 currently being hidden, though the locations of these lines fluctuate wildly.

    Any thoughts? Or would this be really complicated?
    Last edited by petalred; 11-04-2008 at 11:17 AM.

  2. #2
    Valued Forum Contributor Richard Schollar's Avatar
    Join Date
    05-23-2006
    Location
    Hampshire UK
    MS-Off Ver
    Excel 2002
    Posts
    1,264
    I may be incorrect, but I think you would need to go thru an iterative process to determine whether the row was visible and if so, extract all the data from that row in the given ranhe (including hidden columns). If this is the case, then it won't be as fast (or as easy) as simply executing a Copy method as you do at the moment. Could you just unhide the hidden columns, and then do the copy?
    Richard Schollar
    Microsoft MVP - Excel

  3. #3
    Registered User
    Join Date
    07-31-2008
    Location
    Philadelphia, PA
    Posts
    40
    Well, what I'm doing is: I have a button that copies the current list of products we carry from our daily buy sheet and pastes it into an inventory sheet, laid out to be printed for counting. We're in the produce industry, so we take a daily inventory and what we carry fluctuates almost daily. This is a shortcut to update our inventory sheet with the click of a button to stop from having to manually edit it every time something changes.

    The rows are the types of products, and the columns are various numbers related to how much we should be buying. The hidden rows are part of a script that adds a new type of fruit to the buy-sheet with the click of a button, so no time needs to be spent formatting anything. Essentially, the button copies the hidden row and pastes a copy directly above that hidden row, preserving the identity of all my named ranges and the formatting of that hidden row. These hidden rows have "INSERT NAME" written as the name of the fruit, and obviously don't need to be included on the inventory sheet. The hidden columns, on the other hand, are full of formulas that would clutter everything visually if they were visible on the buy-sheet, but the way they're formatted gives me the right layout when they're copied and pasted onto the inventory sheet (all the content after the names gets deleted after pasted onto the new sheet, and only the formatting remains).

    So, it would really be ideal to copy all the hidden columns and not the hidden rows, and since the whole point of the button is to keep things extremely simple, I'd rather not have to unhide two columns every time I want to push it. If it's too complicated, I won't worry about it, though. The alternative is I could just reformat the layout of the inventory sheet to accomodate for the lack of hidden columns, but I don't think I'll be able to get it to look as clean.

  4. #4
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302
    I guess something like this?
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-31-2008
    Location
    Philadelphia, PA
    Posts
    40
    Wow. That definitely seemed to work. Now, I'm going to have to dig through it and try to understand why. Thanks!

+ Reply to Thread

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