+ Reply to Thread
Results 1 to 7 of 7

How to copy/paste only what is visible

  1. #1
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    How to copy/paste only what is visible

    I have this code below and it copies everything in Range("AA7:AQ100")
    But I want it to only copy/paste the VISIBLE ROWS, not all of them.
    So when the result is pasted in "AA105" it will paste only what is visible

    How do I correct this code????
    Please help!

    Please Login or Register  to view this content.
    Thanks!
    Last edited by nenadmail; 08-08-2012 at 04:40 AM.

  2. #2
    Forum Guru benishiryo's Avatar
    Join Date
    03-25-2011
    Location
    Singapore
    MS-Off Ver
    Excel 2013
    Posts
    5,147

    Re: How to copy/paste only what is visible

    hi nenadmail. just a wild guess by playing around with recording, you can try using this:
    Please Login or Register  to view this content.
    instead of just:
    Please Login or Register  to view this content.
    not an expert in VBA though. sorry if it didnt help

    Thanks, if you have clicked on the * and added our rep.

    If you're satisfied with the answer, click Thread Tools above your first post, select "Mark your thread as Solved".

    "Contentment is not the fulfillment of what you want, but the realization of what you already have."


    Tips & Tutorials I Compiled | How to Get Quick & Good Answers

  3. #3
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to copy/paste only what is visible

    Please Login or Register  to view this content.
    Excellent... it works when there's something to select... but in case there's nothing visible in the range to select... I need the macro to STOP and END with just the following:

    Please Login or Register  to view this content.
    Last edited by nenadmail; 08-08-2012 at 08:35 AM.

  4. #4
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to copy/paste only what is visible

    Copying a range with hidden rows & columns will only copy what is visible anyway
    Hope that helps.

    RoyUK
    --------
    For Excel Tips & Solutions, free examples and tutorials why not check out my web site

    Free DataBaseForm example

  5. #5
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to copy/paste only what is visible

    Right... but sometimes there's nothing visible in that range.... so I need the code to behave differently in that case.

    I just need to insert somewhere:
    If nothing selected, ELSE go to Range "A1"

  6. #6
    Forum Expert royUK's Avatar
    Join Date
    11-18-2003
    Location
    Derbyshire,UK
    MS-Off Ver
    Xp; 2007; 2010
    Posts
    26,200

    Re: How to copy/paste only what is visible

    If you are going to use SpecialCells then it's best to wrap an error handler round to prevent an error caused by the lack of any Specialcells

    Please Login or Register  to view this content.

  7. #7
    Forum Contributor
    Join Date
    05-19-2012
    Location
    Croatia
    MS-Off Ver
    Excel 2007
    Posts
    200

    Re: How to copy/paste only what is visible

    Thanks... but your code changed a lot of things... the previous one worked, all I need is one little change which is:

    PUT "ELSE" in it to just behave a little differently.
    IF ALL ROWS end up being hidden, then END Macro with: Range("A1").Select


    This section of the code below can sometimes in certain circumstances HIDE everything in the range of rows "7:100"...
    Please Login or Register  to view this content.
    IF that happens, then all I need is something to be added in the code to STOP the VBA from running the rest of the code, which is the following section:
    Please Login or Register  to view this content.

    ELSE, in this rare but plausible case the VBA needs to end with only:
    Please Login or Register  to view this content.

    Please, if you can do that only... It will be fine and work perfectly!
    Thank you very much for your help... I really appreciate it!
    Last edited by nenadmail; 08-08-2012 at 02:54 PM.

+ 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