+ Reply to Thread
Results 1 to 10 of 10

Look for yes in one column n remove cell color from first column in that row

  1. #1
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Look for yes in one column n remove cell color from first column in that row

    Hello Everybody, I have a question question hopefully somebody can help me with the programming. I want to create a macro to search Column I to see if it says the word "Yes" in a certain row if it does it removes the cell color from Column A in that row. It will then move onto the next row. If Column I says "No" it will skip that row and move onto the next row. I would need it to do a continuous loop until it finds a blank row. I appreciate the help on any coding you may have. Thank You.

  2. #2
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Look for yes in one column n remove cell color from first column in that row

    Try:
    Please Login or Register  to view this content.
    Untested.
    Thanks,
    Solus


    Please remember the following:

    1. Use [code] code tags [/code]. It keeps posts clean, easy-to-read, and maintains VBA formatting.
    Highlight the code in your post and press the # button in the toolbar.
    2. Show appreciation to those who have helped you by clicking below their posts.
    3. If you are happy with a solution to your problem, mark the thread as [SOLVED] using the tools at the top.

    "Slow is smooth, smooth is fast."

  3. #3
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Look for yes in one column n remove cell color from first column in that row

    Please Login or Register  to view this content.
    Haven't tested this yet because I have a long macro running on my computer right now, but try it out in a test workbook to see if it works.
    Last edited by LaffyAffy13; 07-22-2013 at 04:59 PM.
    ~~LaffyAffy13~~

    If I have helped you solve your problem, please be sure to click at the bottom left of my post.

    Thanks.

  4. #4
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Look for yes in one column n remove cell color from first column in that row

    Lol didn't see Solus's post

  5. #5
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Look for yes in one column n remove cell color from first column in that row

    Hey Thanks for the reply, The macro works but unfortunately it doesn't remove the color from the cell. That's my fault I should have included the following code to show you how I'm formatting the cell with the color. Here it is hopefully this is helpful in helping me.

    Sub FindDups()
    '
    ' NOTE: You must select the first cell in the column and
    ' make sure that the column is sorted before running this macro
    '
    Application.ScreenUpdating = False
    FirstItem = ActiveCell.Value
    SecondItem = ActiveCell.Offset(1, 0).Value
    Offsetcount = 1
    Do While ActiveCell <> ""
    If FirstItem = SecondItem Then
    ActiveCell.Offset(0, 0).Interior.Color = RGB(255, 0, 0)
    ActiveCell.Offset(Offsetcount, 0).Interior.Color = RGB(255, 0, 0)
    Offsetcount = Offsetcount + 1
    SecondItem = ActiveCell.Offset(Offsetcount, 0).Value
    Else
    ActiveCell.Offset(Offsetcount, 0).Select
    FirstItem = ActiveCell.Value
    SecondItem = ActiveCell.Offset(1, 0).Value
    Offsetcount = 1
    End If

    Loop

    End Sub

  6. #6
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Look for yes in one column n remove cell color from first column in that row

    Trevor,

    I don't understand, the goal of the macro (its only action) was to remove the formatting, how did it work if it didn't remove the color?

    Also, why use off set if you're not offsetting any rows or columns?

    ActiveCell.Offset(0, 0).Interior.Color = RGB(255, 0, 0)

  7. #7
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Look for yes in one column n remove cell color from first column in that row

    This code is basically another step of a much larger macro. I was just showing you that so you knew how I did the formatting for the cell color earlier. Which carries over into this portion of the coding. When I said it was working I mean that it runs through goes thru each line and looks for the correct stuff. Unfortunately, it is not removing the cell color and I didn't know if that was because I formatted it differently earlier. I don't really wanna change the coding of the FindDups Macro because this programming has been working for a while. My apologies for not making much sense on this and hopefully this cleared some questions up.

  8. #8
    Forum Expert Solus Rankin's Avatar
    Join Date
    05-24-2013
    Location
    Hollywood, CA
    MS-Off Ver
    Win7 Office 2010 VS Express 2012
    Posts
    2,655

    Re: Look for yes in one column n remove cell color from first column in that row

    If I use this:
    Please Login or Register  to view this content.
    to set cell A1 to red, and type yes into I1 and run this:
    Please Login or Register  to view this content.
    It removes the red color from A1.

  9. #9
    Forum Contributor
    Join Date
    07-24-2012
    Location
    Denver, CO
    MS-Off Ver
    365
    Posts
    230

    Re: Look for yes in one column n remove cell color from first column in that row

    My code also does the job.

    You may have preset conditional formatting for your cells. That might reverse the code depending on the formatting. If so, try adding this into the code.

    Please Login or Register  to view this content.

  10. #10
    Forum Contributor
    Join Date
    06-15-2013
    Location
    United States
    MS-Off Ver
    Excel 2016
    Posts
    213

    Re: Look for yes in one column n remove cell color from first column in that row

    Thank you it worked!

+ 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. [SOLVED] Remove duplicate entries from one column and output it into another column using formulas
    By alrikvincent in forum Excel Formulas & Functions
    Replies: 15
    Last Post: 07-12-2014, 08:55 AM
  2. [SOLVED] Color-format a cell which contains data in a column based on the color of another cell
    By Nit3hawK in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-27-2013, 05:25 PM
  3. Remove rows with duplicate values in one column based on value of another column
    By jolleyje in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 03-15-2013, 06:20 AM
  4. Color if date in column n and stop color at column n
    By dalet in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-19-2009, 01:55 PM
  5. how to remove spaces in a cell/column
    By P.M.SANJAY in forum Excel General
    Replies: 4
    Last Post: 01-07-2006, 04:21 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