Highlight entire row when cell selected or being edited

dim4x4

Board Regular
Joined
May 8, 2002
Messages
108
Hello!

I want to have an entire row highlighted when I select or edit a cell in that row. Then when I select or edit a cell in a different row, I want initial row "unhighlighted" (i.e. returned to previous state), and the new row highlighted. Basically, I want to see which row I am working on right now.

Thank you!
 
If I record a macro that adds a forumula to CF. And a macro that removes CF. Then assign a button for each macro. Will this work?
 
Upvote 0

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Thank you!

PS. Unfortunately macro recorder does not record changes to conditional formatting ((
 
Last edited:
Upvote 0
It does if you select conditional, new rule, use a formula.
 
Upvote 0
Sorry for bothering you Fluff, but my macro does not select row. Here's my code:
VBA Code:
Sub Macro1()

    Selection.FormatConditions.Add Type:=xlExpression, Formula1:= _
        "=ROW()=CELL(""ROW"")"
    Selection.FormatConditions(Selection.FormatConditions.Count).SetFirstPriority
    With Selection.FormatConditions(1).Interior
        .PatternColorIndex = xlAutomatic
        .ThemeColor = xlThemeColorAccent4
        .TintAndShade = 0.599963377788629
    End With
    Selection.FormatConditions(1).StopIfTrue = False
    
End Sub

It only highlights the previous selection. I want it to highlight rows and be applicable to $A$2:$DG$3000 range. Maybe I should put my macro not in the Module, but in Sheet1?
 
Upvote 0
What is the name of the sheet?
 
Upvote 0
Ok, try
VBA Code:
Sub Macro1()

   With Sheets("Mail Merge").Range("A2:DG3000")
      .FormatConditions.Add Type:=xlExpression, Formula1:="=ROW()=CELL(""ROW"")"
      .FormatConditions(.FormatConditions.Count).SetFirstPriority
      With .FormatConditions(1).Interior
          .PatternColorIndex = xlAutomatic
          .ThemeColor = xlThemeColorAccent4
          .TintAndShade = 0.599963377788629
      End With
      .FormatConditions(1).StopIfTrue = False
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,216,082
Messages
6,128,700
Members
449,464
Latest member
againofsoul

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