highlight complete row excel vba with week number as text

wells

New Member
Joined
Jan 9, 2020
Messages
24
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
With VBA is it possible to highlight a row referring a cell in a column having multiple week number in format "W**".

for example: column R in below case will have W01, W03 .... I need to highlight only those particular cells.

I am stuck with the below format.

VBA Code:
 With Cells
        .FormatConditions.Add Type:=xlExpression, Formula1:= _
          "=($R1="" W** "")"
        With .FormatConditions(.FormatConditions.Count)
            .SetFirstPriority
            With .Interior
                .PatternColorIndex = xlAutomatic
                .Color = 15983281
                .TintAndShade = 0
            End With
            StopIfTrue = False
        End With
         End With
 

Excel Facts

Wildcard in VLOOKUP
Use =VLOOKUP("Apple*" to find apple, Apple, or applesauce
Conditional Formatting directly in the sheet works great. You can specify for the 'rule' to apply to a whole range, but it still can do the CF on a per-cell basis, or a row or a column. Sequence multiple CFs and the sky is the limit.

Edit: Some Info Use conditional formatting to highlight information

I've got some rules that simulate computer lined paper, one blank, next light gray background, based on modula 2 i.e. if the row number is even, gray background, if uneven, white/no background.
=MOD(ROW(),2)=1 applying to =$A$3:$R$52, $T$3:$Z$52,
 
Last edited by a moderator:
Upvote 0
How about
VBA Code:
Sub wells()
   With ActiveSheet.UsedRange
      .FormatConditions.Delete
      .FormatConditions.Add xlExpression, , "=left($R1,1)=""W"""
      With .FormatConditions(.FormatConditions.Count)
         .Interior.Color = 15983281
      End With
   End With
End Sub
 
Upvote 0
Hi fluff,

I already have a condition for "What"... which contradicts with this i believe!!
 
Upvote 0
Ok, how about
VBA Code:
Sub wells()
   With ActiveSheet.UsedRange
      .FormatConditions.Delete
      .FormatConditions.Add xlExpression, , "=and(len($R1)=3, left($r1,1)=""W"")"
      With .FormatConditions(.FormatConditions.Count)
         .Interior.Color = 15983281
      End With
   End With
End Sub
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,286
Members
452,631
Latest member
a_potato

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