VBA Activate Cell = color change

Pinaceous

Well-known Member
Joined
Jun 11, 2014
Messages
1,113
Office Version
  1. 365
Platform
  1. Windows
Hi All,

I'm working with a column H11:H180; where if a value is entered into this column, I'd like the adjacent cell to turn red until a value is entered into that cell.

For example, if I enter a value into cell H11, the cell I11 will turn red until a value is entered here.

Likewise, if I enter in a value into cell H12, the cell I12 will turn red until a value is entered here and so on until cell H180 of that column.

Can you help me figure this out?

Thank you!
pinaceous
 
Update to the post.



Right now, the code works perfectly where if an entry is typed into Column H, its corresponding Column I produces the red content.




VBA Code:
Private Sub ColumnH_ChangeI(ByVal Target As Range)
  Dim Changed As Range, rw As Range

    
  Set Changed = Intersect(Target, Range("H11:I180"))
  If Not Changed Is Nothing Then
    Application.EnableEvents = False
    For Each rw In Intersect(Changed.EntireRow, Columns("H:I")).Rows
      With rw.Cells(1, 2)
        If Not IsEmpty(.Offset(, -1).Value) And IsEmpty(.Value) Then
          .Value = "Enter!"
     
          .Interior.Color = vbRed
          
        Else
          .Interior.Color = xlNone

          If .Value = "Enter!" Then .ClearContents
        End If
      End With
    Next rw
    Application.EnableEvents = True
  End If
End Sub


I would like the code to now do the reverse of what it is currently doing but I cannot figure it out. -->??



I would like the code when an entry is typed into Column I, its corresponding Column H will produce the red content?




Can someone help me?


Thanks!
Pinaceous
 
Upvote 0

Excel Facts

Whats the difference between CONCAT and CONCATENATE?
The newer CONCAT function can reference a range of cells. =CONCATENATE(A1,A2,A3,A4,A5) becomes =CONCAT(A1:A5)

Forum statistics

Threads
1,214,973
Messages
6,122,534
Members
449,088
Latest member
RandomExceller01

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top