+ Reply to Thread
Results 1 to 11 of 11

Search within a column and repeat the search until all items are found

  1. #1
    Registered User
    Join Date
    11-06-2013
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    42

    Search within a column and repeat the search until all items are found

    I have a spreadsheet that has formulas in Column H that determine if certain data is present in column G, and if so, displays the word "TODAY" in the corresponding row in Column H. I want a macro to search Column H for the cells containing the word "TODAY". When it finds the word "TODAY", it freezes the date in the corresponding row in Column G and then searches for the next word "TODAY" in Column H, until all have been found and all dates have been frozen. Column H will have no more than 200 cells (H6:H206) with the potential for the word "TODAY" in a cell. I know how to freeze the dates but I don't know how to search Column H for the next available "TODAY".
    Please Login or Register  to view this content.
    Thanks for the assistance. Randy
    Last edited by Leith Ross; 01-06-2014 at 01:30 PM. Reason: Added Code Tags

  2. #2
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Search within a column and repeat the search until all items are found

    Not sure about what you mean by freeze. But maybe?

    Please Login or Register  to view this content.

  3. #3
    Forum Moderator Leith Ross's Avatar
    Join Date
    01-15-2005
    Location
    San Francisco, Ca
    MS-Off Ver
    2000, 2003, & 2010
    Posts
    23,258

    Re: Search within a column and repeat the search until all items are found

    Hello Randy,

    You will need to add your freeze date code to this macro. It is marked by a comment in the Do loop. I am assuming that "Top" is named cell on the worksheet "Summary". If it is not then the code will fail.
    Please Login or Register  to view this content.
    Sincerely,
    Leith Ross

    Remember To Do the Following....

    1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.
    2. Thank those who have helped you by clicking the Star below the post.
    3. Please mark your post [SOLVED] if it has been answered satisfactorily.


    Old Scottish Proverb...
    Luathaid gu deanamh maille! (Rushing causes delays!)

  4. #4
    Registered User
    Join Date
    11-06-2013
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Search within a column and repeat the search until all items are found

    Thanks much for your responses. Neither macro was able to find the word "TODAY". Perhaps I misinterpreted what I was supposed to do but I copied them essential verbatim.

    I attempted to attach an image of the spreadsheet so you could see exactly what I am talking about but it doesn't look like it worked.

    The macro simply needs to go from 1 cell to another in column H looking for the word "TODAY". If you can get me that far, I can take it the rest of the way.

    TODAY.JPG

  5. #5
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Search within a column and repeat the search until all items are found

    Both codes should do that. If they are not working can you provide a sample with some data as depicted in the .jpg file?

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    11-06-2013
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Search within a column and repeat the search until all items are found

    Still did not work. Here is a sample of the forumulas used in those columns

    TODAY1.JPG

  7. #7
    Forum Expert
    Join Date
    06-12-2012
    Location
    Ridgefield Park, New Jersey
    MS-Off Ver
    Excel 2003,2007,2010
    Posts
    10,241

    Re: Search within a column and repeat the search until all items are found

    I meant attaching a sample worksheet with some data which is not responding to the macros. To attach a file, push the button with the paperclip (or scroll down to the Manage Attachments button), browse to the required file, and then push the Upload button.

  8. #8
    Registered User
    Join Date
    11-06-2013
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Search within a column and repeat the search until all items are found

    Thanks much for all of your effort. I have managed to get the find function working with a Do Loop. It moves sucessfully from "Today" to "Today" but when it gets to the last "Today" the macro freezes and won't fully complete the macro. I don't have the ability to attach the spreadsheet.

    Here's my current macro

    Please Login or Register  to view this content.

  9. #9
    Registered User
    Join Date
    11-06-2013
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Search within a column and repeat the search until all items are found

    PS: There is a Loop statement that I inadvertently left out

  10. #10
    Registered User
    Join Date
    11-06-2013
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    42

    Post Re: Search within a column and repeat the search until all items are found

    Sorry for the delay. I have attached a copy of the file that I am using with the macro

    SUMMARY2.xlsm

    Here is a copy of the macro I am attempting to use. Again, the intent of the macro is to freeze the dates in Column G.

    Please Login or Register  to view this content.

  11. #11
    Registered User
    Join Date
    11-06-2013
    Location
    NC
    MS-Off Ver
    Excel 2007
    Posts
    42

    Re: Search within a column and repeat the search until all items are found



    For those that are interested, I finally got this macro to work. This is a handy little macro and may be beneficial to those that search for specific words in a column or row.

    Please Login or Register  to view this content.

+ 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: 2
    Last Post: 09-13-2013, 11:02 AM
  2. [SOLVED] Search for a value and if the value is found copy the whole row. And repeat the proces
    By beamonemo in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 08-13-2012, 02:34 PM
  3. [SOLVED] Search for string across header row, then search for another string down found column
    By TucsonJack in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 05-14-2012, 02:09 PM
  4. [SOLVED] Macro ignores search code when 1 of the 2 search parameters is not found
    By BrodyNoochie in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-25-2012, 05:21 PM
  5. Create a search box that jumps to items found in list
    By cadmancan in forum Excel Formulas & Functions
    Replies: 0
    Last Post: 10-27-2009, 11:44 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