+ Reply to Thread
Results 1 to 7 of 7

Needing a macro to Find, Select, Copy if...

  1. #1
    Registered User
    Join Date
    09-23-2020
    Location
    US
    MS-Off Ver
    Ofice 16
    Posts
    22

    Needing a macro to Find, Select, Copy if...

    I have data in Columns A:H and I'm wanting a macro to select data in columns A:C if it finds "Route 11" in column D and "Scheduled" in Column G and do nothing if nothing meets the criteria.

    I'm wanting the macro to be tied to a Button and I'm wondering if there is a way to turn the button bright green if there is data that meets the criteria to be copied and the button to be red if there's no data that meets the criteria, so the user doesn't waste their time clicking the button and trying to copy nothing.

    I've included a test file as well if it helps.


    I have also posted the following question here: https://www.mrexcel.com/board/thread...py-if.1146925/
    Attached Files Attached Files
    Last edited by bjc124; 09-28-2020 at 10:36 AM.

  2. #2
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Needing a macro to Find, Select, Copy if...

    Which tab are you searching as I find no tabs with data in Column G. Which tab should the data be copied from and where should it be pasted. Really need you to be more specific in your ask and show a before and after (and indicate which is which). We are not mind readers here and only you know what you want. The rest of us need to be told.
    Alan עַם יִשְׂרָאֵל חַי


    Change an Ugly Report with Power Query
    Database Normalization
    Complete Guide to Power Query
    Man's Mind Stretched to New Dimensions Never Returns to Its Original Form

  3. #3
    Registered User
    Join Date
    09-23-2020
    Location
    US
    MS-Off Ver
    Ofice 16
    Posts
    22

    Re: Needing a macro to Find, Select, Copy if...

    I just update the test file in the Original post, not sure why there wasn't any data there.

    I'm searching the "Hauls" tab and I'm just wanting to have the data copied to the clipboard as is it will be pasted within another application.

    Column A Header - Name
    Column B Header - Date to Haul
    Column C Header - Time To Haul
    Column D Header - Route
    Column E Header - Location
    Column F Header - Hauling Company
    Column G Header - Status
    Column H Header - Notes

    I'm needing a Command Button "Route 11" that when clicked it will search all the rows in the worksheet where:

    Column D = "Route 11" & Column G = "Scheduled"

    and then select and copy columns A:C of those rows


    As far as the Command Button Goes if just wanting it's color properties to be dependent on if the count of: Column D = "Route 11" & Column G = "Scheduled" > 0
    Last edited by bjc124; 09-28-2020 at 08:12 AM.

  4. #4
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Needing a macro to Find, Select, Copy if...

    You can attach this code to a button.

    Please Login or Register  to view this content.

  5. #5
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    365 Pro Plus
    Posts
    2,274

    Re: Needing a macro to Find, Select, Copy if...

    Possibly...
    Please Login or Register  to view this content.

  6. #6
    Forum Moderator alansidman's Avatar
    Join Date
    02-02-2010
    Location
    Steamboat Springs, CO
    MS-Off Ver
    MS Office 365 Version 2405 Win 11 Home 64 Bit
    Posts
    23,895

    Re: Needing a macro to Find, Select, Copy if...

    Administrative Note:

    Welcome to the forum.

    We would very much like to help you with your query, however it has been brought to our attention that the same query has been posted on one or more other forums and you have not provided the required cross-post link(s) here.

    Please see Forum Rule #3 about cross-posting and adjust accordingly. Read this to understand why we (and other sites like us) consider this to be important.

    (Note: this requirement is not optional. No help to be offered until the link is provided.)

  7. #7
    Registered User
    Join Date
    09-23-2020
    Location
    US
    MS-Off Ver
    Ofice 16
    Posts
    22

    Re: Needing a macro to Find, Select, Copy if...

    I updated my post with link to the other question.

+ 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. Replies: 1
    Last Post: 08-18-2016, 03:17 AM
  2. [SOLVED] Excel VBA Macro - Find Word and Select that Column to Column D and copy
    By MsBBStacker in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 11-02-2015, 12:04 AM
  3. find-select-copy function Vba
    By sergiu_ciuhnenco in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 01-26-2015, 10:12 AM
  4. [SOLVED] Vba : Find select offset copy and paste
    By Atik in forum Excel General
    Replies: 6
    Last Post: 12-21-2014, 11:38 AM
  5. Find and Select, Copy and Paste.
    By johnlovesbeer in forum Excel General
    Replies: 7
    Last Post: 07-06-2011, 10:04 PM
  6. select range to copy, find values and copy
    By SarahPintal in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 02-04-2010, 07:44 PM
  7. [SOLVED] Needing to select file path with Set command
    By [email protected] in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 12-20-2005, 05:50 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