Change format of cell based on value of cell in corresponding row?

EssKayKay

Active Member
Joined
Jan 5, 2003
Messages
413
Office Version
  1. 2007
Platform
  1. Windows
Hello,

I’m looking for a routine to change the status (format) of a cell in column I based on the status of a corresponding cell in the same row in column M for a range “M33:M2000” (or “I33:I2000”). I want the action to happen when the value of the cell in column M > 0. If the value of the cell in column M = 0 (or blank) then do nothing. Column M is actually formatted to Date. I would run this process via a command button.

Example: If the value in M44 is 06/12/23, then change the format of cell I44 to “Locked” and the font color to Black. Normally all cells in “I33:I2000” are unlocked & blue.

Thanks for viewing,
Steve K.
 

Excel Facts

Excel motto
Not everything I do at work revolves around Excel. Only the fun parts.
One more issue Awoohaw,

Here's what I'm seeing when I run the revised Test routine. Again, I'm sure I'm probably missing something here.

View attachment 112496

View attachment 112497

Thank you once again,
Steve
You probably need to run this code separately since you went into break/debugging mode, the screen updating and record locking may be all awry.
Also, please note that I am writing Col EYE, not Col ONE or Col ELL.

VBA Code:
Sub ResetWorkbook()

Dim CurSheetName as string
Dim ColIAddress as string
Dim ColI as Range

Application.ScreenUpdating = False

CurSheetName = ThisWorkbook.ActiveSheet.Name

Sheets(CurSheetName).Select

Range("I2").Select
ColIAddress = Selection.CurrentRegion.Offset(1, 0).Address
Set ColI = Range(ColIAddress)

For Each Cell In ColI
    Cell.Locked = False
    Next Cell

Application.ScreenUpdating = True
End Sub
 
Upvote 0
Ahh Awoohaw - I think I got it. I had to do some adjusting but it looks like it's going to do what I have in mind. I will play with this more tomorrow. If I need more help, I'll be back. I'll keep you posted. . .

Once again, very much appreciated,
Steve K.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,224,701
Messages
6,180,442
Members
452,985
Latest member
Hai Quynh

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