+ Reply to Thread
Results 1 to 9 of 9

Search for a column based on a header name and then searching only that column

  1. #1
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Search for a column based on a header name and then searching only that column

    Hi all!

    Excel VBA novice back at it again. I am trying to create a macro that will search for a column by header name that is in the first row. And then search only that column for cells that value = 0. If they do = 0 I would like to highlight the entire row where that value exists as it needs to be marked in my data set.

    For simplicity sake We can search for a column called Service. Then search that column for values of 0. And then highlight the row where the 0 exists. Any help would be greatly appreciated and I apologize if I left any important information out. I can't send the actual data set, but if necessary I will provide a dummy sheet to replicate my needs.

    Thank you,
    Scott
    Last edited by sokeefe14; 05-12-2015 at 10:26 AM.

  2. #2
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Search for a column based on a header name and then searching only that column

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Search for a column based on a header name and then searching only that column

    Great thank you! Works like a charm!

    As a follow up, if I wanted to do the same thing, but instead of searching for 0... I wanted to find cells where the first two characters were "zz" and then highlight. How would I go about doing that?

  4. #4
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Search for a column based on a header name and then searching only that column

    Change the first Set d line to:

    Please Login or Register  to view this content.

  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 for a column based on a header name and then searching only that column

    FWIW:

    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Search for a column based on a header name and then searching only that column

    You guys are awesome, thanks.

  7. #7
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Search for a column based on a header name and then searching only that column

    Gonna throw this in here too since you guys have been so helpful. I have tried to get this one answered before to no success, but it runs along these lines.

    Its based off of 3 separate columns. FY, Location, and O&M.

    FY has 4 possible values : 2010-2013
    Location has hundreds of locations. Each location has data for all 4 years so each location appears 4 times in the data set.
    O&M is cost data

    I want to find the column O&M and search for where it = 0 for the latest 2 years (FY = 2012 and FY= 2013). When that is true I want to highlight all 4 rows for that location that has reported 0 for the last 2 years as it signals to us that they are no longer collecting the data.

  8. #8
    Forum Expert
    Join Date
    08-28-2014
    Location
    Texas, USA
    MS-Off Ver
    2016
    Posts
    1,796

    Re: Search for a column based on a header name and then searching only that column

    This is fairly straightforward, and I've no issue providing a solution, but this really needs to be a new thread to comply with forum rules. If you post it as a new thread, I'll see it and answer.

  9. #9
    Registered User
    Join Date
    05-06-2015
    Location
    virginia, USA
    MS-Off Ver
    2013
    Posts
    37

    Re: Search for a column based on a header name and then searching only that column

    Ah ok, sorry I am new here. Just posted. Thank you again for all of your help.

+ 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. Return the column header by searching for a specified value in a row
    By lc06171970 in forum Excel Formulas & Functions
    Replies: 5
    Last Post: 09-25-2014, 05:56 PM
  2. Return column header based on column criteria and number value
    By bwill22 in forum Excel Formulas & Functions
    Replies: 3
    Last Post: 02-07-2014, 07:33 PM
  3. Replies: 1
    Last Post: 01-30-2014, 01:42 PM
  4. Search for column header and find all values and their row numbers in that column
    By woody83 in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-14-2012, 03:11 PM
  5. Replies: 1
    Last Post: 05-02-2008, 04:57 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