+ Reply to Thread
Results 1 to 4 of 4

VBA to Turn Off Highlight When User Inputs Data

  1. #1
    Registered User
    Join Date
    04-09-2013
    Location
    New york
    MS-Off Ver
    Excel 2010
    Posts
    5

    VBA to Turn Off Highlight When User Inputs Data

    Hi,
    I have a macro that checks for empty cells in column A & B and highlight them in red. After the user inputs data into those empty cells that are red now, I want the highlight to be turned off (i.e) the cell background should be white. How can I incorporate this in the macro that I have? The code that I have is given below. Could someone please help me? This is kind of urgent, any help is greatly appreciated. Thanks.


    Sub CheckEmpty_New3()
    Dim rng As Range
    Dim cell As Object
    Dim cell1 As Object
    Set rng = Range("A7:A" & Range("A" & Rows.Count).End(xlUp).Row)
    For Each cell In rng
    If cell = "" Then
    cell.Interior.ColorIndex = 3
    Else
    If cell.Value = "N" And Len(Trim(Range(cell.Address).Offset(0, 1).Value)) = 0 Then
    cell.Offset(0, 1).Interior.ColorIndex = 3
    End If
    End If
    Next
    MsgBox ("Missing Data. Please fill in the cells highlighted in RED")
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: VBA to Turn Off Highlight When User Inputs Data

    Use conditional formatting

    =$A1="" .................. Condition red
    =$B1="".................... Condition red
    Elegant Simplicity............. Not Always

  3. #3
    Registered User
    Join Date
    04-09-2013
    Location
    New york
    MS-Off Ver
    Excel 2010
    Posts
    5

    Re: VBA to Turn Off Highlight When User Inputs Data

    Hi,

    Can you please give me the complete VBA code to incorporate this into my macro code given above?

    Many Thanks.

  4. #4
    Valued Forum Contributor
    Join Date
    03-29-2013
    Location
    United Kingdom
    MS-Off Ver
    Office/Excel 2013
    Posts
    1,749

    Re: VBA to Turn Off Highlight When User Inputs Data

    You don't need VBA... You just apply conditional formatting...

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

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