+ Reply to Thread
Results 1 to 10 of 10

Copy and Paste cells if cell contains keyword

  1. #1
    Registered User
    Join Date
    07-10-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Copy and Paste cells if cell contains keyword

    Hi all,

    Need some help with a VBA copy and paste question

    Currently i have file names in column C starting at C14 and hyperlinks associated with the file in Column H starting at H14 in worksheet "File Manager"

    I want to be able to place a key word in sheet "Search" in cell B14 that when a search command button is clicked on the "search" sheet, it searches for file names in "file manager" column C starting at C14 containing the keyword and all files along with associated hyper links are copied and pasted to the "search" worksheet, file names in Column C starting at C21 and Hyperlinks in column P staring at P21

    Any help would be much appreciated.

  2. #2
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Copy and Paste cells if cell contains keyword

    Hi Daz_1983

    Difficult without your scenario.....This might give you an idea...
    If not, upload a sample workbook so that we can see what you are referring to....Actually in future make a point to always upload a sample workbook depicting a before/after scenario expected.
    Please Login or Register  to view this content.
    Attached Files Attached Files
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  3. #3
    Registered User
    Join Date
    07-10-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Copy and Paste cells if cell contains keyword

    Here is the workbook that contains everything.
    I have Put what I want to happen in red. The file manager sheet is where I want the data to come from.
    Attached Files Attached Files
    Last edited by Daz_1983; 07-12-2017 at 05:46 AM.

  4. #4
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Copy and Paste cells if cell contains keyword

    Alrighty then.....
    Lesson 1 and the most important lesson ever......never merge cells....It wreaks havoc....
    the above code will work perfectly for you....I suggest re designing your Sheet1 without merged cells and we'll take it from there...


    edited....But....If you really don't want to use this...
    Please Login or Register  to view this content.
    Last edited by sintek; 07-12-2017 at 05:56 AM.

  5. #5
    Registered User
    Join Date
    07-10-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Copy and Paste cells if cell contains keyword

    Thanks for the advice on merging, that has answered some other (unrelated) issues.
    I have implemented the VBA, However it isn't transferring the file name and hyperlink.
    Also does this VBA allow for part of the file name to be entered in the search?
    I have attached the most up to date version. hope its just something I've missed.
    Attached Files Attached Files

  6. #6
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Copy and Paste cells if cell contains keyword

    According to your new upload the Ranges to populate are no longer C21 & P21... it is F21 & G21
    See attached amended.

    Really...I suggest redesigning...No merging...No Column hides etc etc etc

    Edited....Also...You have hundreds of page breaks which slows your workbook down....Corrected...See upload
    Attached Files Attached Files
    Last edited by sintek; 07-12-2017 at 08:21 AM.

  7. #7
    Registered User
    Join Date
    07-10-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Copy and Paste cells if cell contains keyword

    Hi Sintek, I appreciate the help, my VBA skill is fairly low, only been doing this for a month or so. I do have 2 issue though, the search has to be by typing the word and not a dropdown as the data base its searching is constantly growing. Also the results need to start from the next available row and continue without any gaps. Sorry to be a pain.

  8. #8
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Copy and Paste cells if cell contains keyword

    as the data base its searching is constantly growing
    The Dropdown will always have all available from database....No matter how big
    results need to start from the next available row and continue without any gaps.
    what do you mean by this...

  9. #9
    Registered User
    Join Date
    07-10-2017
    Location
    London
    MS-Off Ver
    2013
    Posts
    7

    Re: Copy and Paste cells if cell contains keyword

    I noticed in the file you sent back, the results for "f" row 6 in the "file manager" sheet, were copied to row 21 of "search" sheet instead of 17 which is the next available empty row.

  10. #10
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,210

    Re: Copy and Paste cells if cell contains keyword

    and pasted to the "search" worksheet, file names in Column C starting at C21 and Hyperlinks in column P staring at P21
    As per your requirement in initial post....
    do you want the first search to be in Row 17 then the next row 18 etc etc etc


    This code will solve ......Providing that all the cells till F16 are populated... Why not upload a file close to the exact file so that we can create the correct code cause thus far you have uploaded 2 diff files with different scenarios...And this will not allow us to assist correctly!!!!
    Please Login or Register  to view this content.
    Last edited by sintek; 07-12-2017 at 09:44 AM.

+ 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. Search cells C1:C3000 for keyword and if exists place a keyword in A1:A3000
    By GregQuick in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 11-24-2015, 07:38 PM
  2. Search keyword in range of cells, then copy entire cell to another column
    By jreil563 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 08-13-2015, 12:46 PM
  3. Paste row from one sheet to another by using keyword or cell color.
    By powtam in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-22-2014, 05:26 PM
  4. Copy paste whole row to new sheet based on keyword
    By jlang11 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-18-2014, 12:44 PM
  5. Filter List by Keyword & copy the result in column by keyword as header
    By kitunga in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2013, 07:16 AM
  6. Replies: 2
    Last Post: 07-13-2012, 04:02 AM
  7. Replies: 1
    Last Post: 12-27-2010, 08:53 AM

Tags for this Thread

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