![]() |
Upper & Lower case problem in VBA
I have the following formula to lock cells if the value in col I = X but
sometimes it may be a lowercase x. How can this be adapted to lock the cells no matter if the x is upper or lower case? For Each cell In ActiveSheet.Range("I13:I1000") With cell .Offset(0, -7).Resize(1, 8).Locked = .Value = "X" End With Next cell |
one way:
For Each cell In ActiveSheet.Range("I13:I1000") With cell .Offset(0, -7).Resize(1, 8).Locked = UCase(.Text) = "X" End With Next cell In article , "Rob" <NA wrote: I have the following formula to lock cells if the value in col I = X but sometimes it may be a lowercase x. How can this be adapted to lock the cells no matter if the x is upper or lower case? For Each cell In ActiveSheet.Range("I13:I1000") With cell .Offset(0, -7).Resize(1, 8).Locked = .Value = "X" End With Next cell |
Thanks JE,
Works great and such a minor change too as I was expecting some complex code. Rob "JE McGimpsey" wrote in message ... one way: For Each cell In ActiveSheet.Range("I13:I1000") With cell .Offset(0, -7).Resize(1, 8).Locked = UCase(.Text) = "X" End With Next cell In article , "Rob" <NA wrote: I have the following formula to lock cells if the value in col I = X but sometimes it may be a lowercase x. How can this be adapted to lock the cells no matter if the x is upper or lower case? For Each cell In ActiveSheet.Range("I13:I1000") With cell .Offset(0, -7).Resize(1, 8).Locked = .Value = "X" End With Next cell |
All times are GMT +1. The time now is 09:54 PM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com