+ Reply to Thread
Results 1 to 14 of 14

Vba/Macro Search Rows for value and copy/paste accordingly

  1. #1
    Registered User
    Join Date
    01-25-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2010
    Posts
    55

    Vba/Macro Search Rows for value and copy/paste accordingly

    Hello,

    I am helping to manage ad inventory/ordering/small emails for a local home operation.
    What im trying to do is take the data from the colored tabs and put it into the appropriate spot on the normal grey tabs by vegetable or fruit. Currently we filter the sheet then copy and paste the data. This becomes a headache when tracking 100s of veggies/fruits/flowers. Is there a way for a macro or vba to reference a list, filter for it, and then copy and paste the data in the correct tab? I already manually did this for Cabbage. Our sheets can turn into a couple hundred fruits/veggies/flowers in one month, so you can imagine how manually painful this becomes. Any sheet modifications or suggestions are warmly welcome.
    Attached Files Attached Files
    Last edited by Aquabat; 11-21-2013 at 10:50 AM.

  2. #2
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    This appears to be a duplicate Thread.

    http://www.excelforum.com/excel-prog...ml#post3482630

    Please ask a Moderator to remove the Duplicate.

    Then answer these questions:

    Will these Reports be generated once a month or periodically throughout the Month?

    If periodically, will the reports be recreated or only new records processed?

    If only new records,will the first three sheets contain only new records or will the old processed records still be there?
    John

    If you have issues with Code I've provided, I appreciate your feedback.

    In the event Code provided resolves your issue, please mark your Thread as SOLVED.

    If you're satisfied by any members response to your issue please use the star icon at the lower left of their post.

  3. #3
    Registered User
    Join Date
    01-25-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Hi John,
    Sorry about the duplication. This thread has the correct attachment. I will ask to close the other post.
    Thank you for the quick reply. They will be generated once a month with only new data.We copy and paste them each month into a running hisotrical file for each category. So each month is a blank sheet with no data anywhere.

  4. #4
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Hi Aquabat

    This Code is in the attached and appears to do as you require...let me know of issues...keyboard shortcut...CTRL + x
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Last edited by jaslake; 11-20-2013 at 02:32 PM.

  5. #5
    Registered User
    Join Date
    01-25-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Hi John, Thank you for the Macro, It works like butter on the sample i sent! Unfortunately when i apply it to the larger list i get a run time error on "If Not Evaluate("ISREF('" & cel.Value & " Store Ad" & "'!A1)") Then" I dont have the foggiest idea what the remedy is to this problem. Would it be better to remove "Store Ad" and the other page titles from the 3 colored tabs?

  6. #6
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Hi Aquabat

    Firstly...What is the Error Message?

    Secondly...Hover over Cel.Value to see what it evaluates to...I suspect it evaluates to Empty or Blank ("") and this may be the source of the problem.

    Thirdly...What's your alternative Sheet Naming Convention? As long as your Sheet Naming Convention in the "large list" is the same as in your Sample File, there's no need to rename them.

    All else fails, upload the "large list" so I can debug the issue.

  7. #7
    Registered User
    Join Date
    01-25-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    The error says :
    "Run Time error '13':
    Type mismatch"

    and when i hover over it says "White Roses"

  8. #8
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Hi Aquabat

    I suspect it has to do with the blank space in "White Roses". I thought I had that handled but if that's the source of the issue, obviously not.

    Two alternatives:
    1. Revise your Sample File to include the "White Roses" records and upload the revised Sample File.
    2. Upload the "large list" File.

    Either way, I'll look at it.

  9. #9
    Registered User
    Join Date
    01-25-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Forgive me in advance, but I cannot figure out how to attach another file.

  10. #10
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Please attach a sample file that represents what you have. The structure of your attachment should be the same structure as your actual data. Any proprietary information should be changed.

    Include in the attachment any code you're currently using (whether it works or not) and an "After" worksheet that demonstrates what you wish the output to be.

    To Attach a File:

    1. Click on Go Advanced
    2. In the frame Attach Files you will see the button Manage Attachments
    3. Click the button.
    4. A new window will open titled Manage Attachments - Excel Forum.
    5. Click the "Add Files"... button to locate your file for uploading.
    6. This will open a new window File Upload...Click "Select Files"
    7. Once you have located the file to upload click the Open button. This window will close.
    8. You are now back in the Manage Attachments - Excel Forum window.
    9. Click the "Upload Files" button and wait until the file has uploaded.
    10. Click the "Done" Button.

  11. #11
    Registered User
    Join Date
    01-25-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Updated the file with a few of the problem names.

  12. #12
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Hi Aquabat

    There were two issues, both dealing with Naming the new Worksheets;

    1. Worksheets containing more than 32 Characters, for example "Red Large Poinsettias Core Products". I resolved this by contracting the Sheet Name to "Red Large Poinsettias CP".

    2. Code does not like the apostrophe in a Sheet Name. When using Code the apostrophe is a Special Character used to delineate a Sheet Name with Spaces in the Name such as "America's Best". So, this line of Code
    Please Login or Register  to view this content.
    will error when it looks for a Sheet Named "America's Best" because it interprets the included Apostrophe as a Special Character. See the discussion here

    http://support.microsoft.com/kb/107468

    The Code in the attached has been modified to handle these exceptions. Let me know of issues.
    Attached Files Attached Files

  13. #13
    Registered User
    Join Date
    01-25-2013
    Location
    Philadelphia
    MS-Off Ver
    Excel 2010
    Posts
    55

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    Works Flawlessly! Thank you so much!

  14. #14
    Forum Expert jaslake's Avatar
    Join Date
    02-21-2009
    Location
    Atwood Lake in Mid NE Ohio...look it up.
    MS-Off Ver
    Excel 2010 2019
    Posts
    12,749

    Re: Vba/Macro Search Rows for value and copy/paste accordingly

    You're welcome...glad I could help. Thanks for the Rep.

+ 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] Macro to search a string, then search above for another one and copy the rows between them
    By DarKDjinni in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-20-2012, 09:36 PM
  2. Search cell in rows and copy paste
    By nicolaforni in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-27-2011, 12:59 PM
  3. Add rows and search/copy/paste text into added rows
    By HelenW in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 10-14-2010, 04:06 AM
  4. Replies: 1
    Last Post: 09-07-2010, 06:23 PM
  5. Search for multiple words and copy/paste rows
    By Excelcreep in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-19-2010, 08:28 PM

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