Cell Content & Format Not Changing With Found Row & Column Values

Ark68

Well-known Member
Joined
Mar 23, 2004
Messages
4,564
Office Version
  1. 365
  2. 2016
Platform
  1. Windows
Will someone review my code below and help me determine why it's not working as hoped?

Rich (BB code):
    alias = WorksheetFunction.VLookup(ws_th.Range("A16"), ws_lists.Range("BQ2:CF25"), 16, False)
    With ws_shifts
        LRow = Application.WorksheetFunction.Match(CDbl(qdate), .Range("A:A"), 0)
        With .Range("A" & LRow & ":BE" & LRow)
            Set rFind = .Find(What:=alias, LookAt:=xlWhole, MatchCase:=False, SearchFormat:=False)
            If Not rFind Is Nothing Then
                With .Cells(rFind.Column, rFind.row)
                    .Value = "Not Staffed"
                    .Interior.ColorIndex = 3 'red
                End With
                With .Cells(rFind.Column - 3, rFind.row)
                    .Value = "X"
                    .Interior.ColorIndex = 3 'red
                End With
            End If
        End With

The code highlighted in purple is supposed to change the value and backcolor of the cell found in the find code. This isn't happening. The code is executed, but the cells don't change.
 

Excel Facts

Round to nearest half hour?
Use =MROUND(A2,"0:30") to round to nearest half hour. Use =CEILING(A2,"0:30") to round to next half hour.
Why are you using
Code:
.Cells(rFind.Column, rFind.row)
rather than just rFind?

If nothing is changing, I suspect your Find operation is not finding anything.
 
Upvote 0
Why am I using ... ?
Code:
.Cells(rFind.Column, rFind.row)

Simple ... I didn't quite realize what 'find' actually provided. It makes sense now, that it finds the address, vs. just the column and/or row.

Thanks Rory ... another lesson learned!

Jen
 
Upvote 0
It returns an actual Range object, not just the address.
 
Upvote 0

Forum statistics

Threads
1,214,915
Messages
6,122,217
Members
449,074
Latest member
cancansova

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