+ Reply to Thread
Results 1 to 11 of 11

Macro to search and highlight a cell prior to the searched cell

  1. #1
    Registered User
    Join Date
    04-14-2013
    Location
    Cheney Kansas
    MS-Off Ver
    Excel Mac 2011
    Posts
    6

    Question Macro to search and highlight a cell prior to the searched cell

    I'm new to the macro world of excel. I program industrial machine code. I want to search my code for a word, such as containing "CYCLE". When found, I want to highlight the prior cell. Thanks.

  2. #2
    Registered User
    Join Date
    04-14-2013
    Location
    Polska
    MS-Off Ver
    Excel 2007
    Posts
    11

    Re: Macro to search and highlight a cell prior to the searched cell

    Hi, try this:
    Please Login or Register  to view this content.

  3. #3
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Macro to search and highlight a cell prior to the searched cell

    Try this
    Please Login or Register  to view this content.
    Last edited by davesexcel; 04-14-2013 at 02:08 PM.

  4. #4
    Registered User
    Join Date
    04-14-2013
    Location
    Cheney Kansas
    MS-Off Ver
    Excel Mac 2011
    Posts
    6

    Re: Macro to search and highlight a cell prior to the searched cell

    Thanks, That succeeded in highlighting the word searched, but not the cell prior to the word searched.

  5. #5
    Forum Moderator davesexcel's Avatar
    Join Date
    02-19-2006
    Location
    Regina
    MS-Off Ver
    MS 365
    Posts
    13,524

    Re: Macro to search and highlight a cell prior to the searched cell

    Who are you responding to?

  6. #6
    Registered User
    Join Date
    04-14-2013
    Location
    Cheney Kansas
    MS-Off Ver
    Excel Mac 2011
    Posts
    6

    Re: Macro to search and highlight a cell prior to the searched cell

    I get this solution to work, but it doesn't highlight the cell prior to the search result like I was wanting

  7. #7
    Registered User
    Join Date
    04-14-2013
    Location
    Cheney Kansas
    MS-Off Ver
    Excel Mac 2011
    Posts
    6

    Re: Macro to search and highlight a cell prior to the searched cell

    J4cub This worked but doesn't highlight the prior cell.

  8. #8
    Registered User
    Join Date
    04-14-2013
    Location
    Cheney Kansas
    MS-Off Ver
    Excel Mac 2011
    Posts
    6

    Re: Macro to search and highlight a cell prior to the searched cell

    Davesexcel. I get an error at line one.

  9. #9
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to search and highlight a cell prior to the searched cell

    I hope J4club is not offended if I butt in
    By prior if you mean on the top of the searched item
    Change this line of the code
    Please Login or Register  to view this content.
    INTO
    Please Login or Register  to view this content.
    By prior if you mean to the left of searched item

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    04-14-2013
    Location
    Cheney Kansas
    MS-Off Ver
    Excel Mac 2011
    Posts
    6

    Re: Macro to search and highlight a cell prior to the searched cell

    AB33, That worked. Thanks. One other question. What do I need to change to make it search for lines that contains the word selected. Not an exact match.

  11. #11
    Forum Expert
    Join Date
    03-28-2012
    Location
    TBA
    MS-Off Ver
    Office 365
    Posts
    12,454

    Re: Macro to search and highlight a cell prior to the searched cell

    Please Login or Register  to view this content.
    INTO

    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)

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