+ Reply to Thread
Results 1 to 9 of 9

Tweak my code so it does not copy rows that are in the shaded area

  1. #1
    Forum Contributor
    Join Date
    02-02-2013
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2010
    Posts
    167

    Tweak my code so it does not copy rows that are in the shaded area

    Here is my question and what I would like to do. Please see attached. I would like to copy all rows accept for the ones that are in the shaded area. (Copy Only...I will not paste this any place back into excel. They will not always fall in the same row area. I want to tweak my "Copy Rows" button, so it does not copy rows that are "Shaded". My Shaded items will alway fall between "General Conditions and "SubTotal General Conditions". Also Shaded items will fall between "Surveying and SubTotal Surveying".

    Sometimes I will have more or less items that are shaded, and they will not alway fall in the same rows, but will always fall between what I have stated above. Can this be done? If so I would really appreciate the help in adding to the marco. Please see attached.
    Attached Files Attached Files
    Last edited by Roco; 09-28-2016 at 07:49 PM.

  2. #2
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Tweak my code so it does not copy rows that are in the shaded area

    Hello Roco,

    Try to replace your entire Code, with the Code below;

    Please Login or Register  to view this content.
    Regards.
    Please consider:

    Be polite. Thank those who have helped you. Then Click on the star icon in the lower left part of the contributor's post and add Reputation. Cleaning up when you're done. If you are satisfied with the help you have received, then Please do Mark your thread [SOLVED] .

  3. #3
    Forum Contributor
    Join Date
    02-02-2013
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2010
    Posts
    167

    Re: Tweak my code so it does not copy rows that are in the shaded area

    Thanks you for your reply. I see and understand what it is doing with the Autofilter. This is the error that I get showing up in yellow.

    [Range("B2:E2", Cells(Rows.CountLarge, "B").End(xlUp).Offset(, 2)).Copy Sheet1.Range("B2")]

  4. #4
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Tweak my code so it does not copy rows that are in the shaded area

    Thank you for the feedback Roco,

    Unfortunately I cannot replicate your problem.

    Please try the attached Workbook, and if the problem persists on your side we would have to try something else, since it works fine on my side.

    Regards.
    Attached Files Attached Files

  5. #5
    Forum Contributor
    Join Date
    02-02-2013
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2010
    Posts
    167

    Re: Tweak my code so it does not copy rows that are in the shaded area

    It worked up to the auto filter and did not copy. I'll download your example in the morning. Thanks so much for working on this. I'll let you know something tomorrow. Roco

  6. #6
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Tweak my code so it does not copy rows that are in the shaded area

    Hi Roco,

    In the meantime, I have tested the sample workbook again,And it works without fail on my side. to make it easier for you, I have even added Buttons to the respective Sheets to make the testing of same easier for you. It is worth at least one Zimbabwean dollar! More or less worth 5 Pennies in you currency. LOL. So you better pay up, to avoid legal proceedings, if only it was worth the effort and paperwork.LOL

    Regards.
    Attached Files Attached Files
    Last edited by Winon; 09-28-2016 at 11:39 PM.

  7. #7
    Forum Contributor
    Join Date
    02-02-2013
    Location
    Jacksonville, Florida
    MS-Off Ver
    Excel 2010
    Posts
    167

    Re: Tweak my code so it does not copy rows that are in the shaded area

    Winon,

    Thanks for the attached....it works, but not what I'm looking for. I do not want it to paste anywhere in excel. I just want to be able to copy the rows that are not shaded, (clip board) so I can paste that information into another software program. Is that possible. I had no idea that a an Zimbabwean dollar was worth so much. For the effort that you have put into this, 5 Pennies is well worth it! I could possible afford 2 Zimbabwean dollars.

  8. #8
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Tweak my code so it does not copy rows that are in the shaded area

    Hi Roco,

    It seems that the Clipboard cannot hold a filtered Range. It appears to ignore filters, and only hold the complete Range as if it is not filtered.

    The only workaround I could come up with, was to Create a Sheet1, and make it invisible. The Filtered Range then gets copied to the hidden Sheet1, and the Code then Copies the Data in Sheet1, from where you can then Paste it to where you want. MSWord, NoteBook, or where you like. There is only one caveat when you paste it to another Excel Sheet. If you do that, it responds but without adjusting Column Width. All you need to do then is to Click on Paste Special, and select Column Widths, Done.

    The sample attached Workbook as below will show you how it works.

    Hope that helps, cause I am tempted to take you on with your offer.
    For the effort that you have put into this, 5 Pennies is well worth it! I could possible afford 2 Zimbabwean dollars.
    Regards.
    Attached Files Attached Files

  9. #9
    Forum Guru Winon's Avatar
    Join Date
    02-20-2007
    Location
    East Rand, R.S.A.
    MS-Off Ver
    2010
    Posts
    6,113

    Re: Tweak my code so it does not copy rows that are in the shaded area

    Hello Roco,

    Thank you for adding to my Reputation

    Please donate the 2 Zimbabwean dollars, to a charity of your choice, and disappear into thin air faster than "Flash".LOL.

    Thanks.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. [SOLVED] Need to tweak code...Hide Rows Based on Cell Value
    By kmlloyd in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 07-21-2015, 11:05 AM
  2. Shading of an excel chart and doing a calculation of the shaded area
    By Rob (SA) in forum Excel Charting & Pivots
    Replies: 2
    Last Post: 07-12-2013, 01:11 PM
  3. Code tweak needed: Copy macro not copying formats only values (with getobject)
    By Gti182 in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 10-19-2012, 01:06 PM
  4. Copy Table Code - Tweak
    By SamuelT in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 12-13-2010, 10:58 AM
  5. code tweak to copy data from sheet1 to sheet2
    By imatomic in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 06-28-2010, 02:18 PM
  6. Representing standard deviation with shaded area?
    By gatsby692 in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 05-21-2008, 06:25 AM
  7. [SOLVED] Shaded Area in Lieu of Excel Charts
    By [email protected] in forum Excel General
    Replies: 2
    Last Post: 08-22-2006, 11:00 AM

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