Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
I am trying to protect all cells in a range with a value 0 so that users can
only input into the non blank cells in the range. I've tried this Sub test() Range("A2:I10").Select If Value = 0 Then Cells.Locked = False End If End Sub but it Unlocks all cells on the Worksheet so I'm obviously doing something very wrong. I'd be grateful for some help please |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
try sub test() For Each c In Range("A2:I10") If c.Value < 0 Then c.Locked = False End If Next end sub bit confused about which cells you want to protect - so let me know if the above gives you what you want. Cheers JulieD "nospaminlich" wrote in message ... I am trying to protect all cells in a range with a value 0 so that users can only input into the non blank cells in the range. I've tried this Sub test() Range("A2:I10").Select If Value = 0 Then Cells.Locked = False End If End Sub but it Unlocks all cells on the Worksheet so I'm obviously doing something very wrong. I'd be grateful for some help please |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
try a loop
for each c in range("a2:i10" if next -- Don Guillett SalesAid Software "nospaminlich" wrote in message ... I am trying to protect all cells in a range with a value 0 so that users can only input into the non blank cells in the range. I've tried this Sub test() Range("A2:I10").Select If Value = 0 Then Cells.Locked = False End If End Sub but it Unlocks all cells on the Worksheet so I'm obviously doing something very wrong. I'd be grateful for some help please |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Thanks a lot for the replies. Julie's solution modified to "If c.Value = 0
Then" works a treat. Thanks again |
#5
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
you're welcome and thanks for the feedback
"nospaminlich" wrote in message ... Thanks a lot for the replies. Julie's solution modified to "If c.Value = 0 Then" works a treat. Thanks again |
#6
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
You might want to test empty cells with c.value ="".
"JulieD" wrote: you're welcome and thanks for the feedback "nospaminlich" wrote in message ... Thanks a lot for the replies. Julie's solution modified to "If c.Value = 0 Then" works a treat. Thanks again |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Non-contiguous cells | Excel Discussion (Misc queries) | |||
counting cells that are 0 in a range of non-contiguous cells | Excel Worksheet Functions | |||
XIRR and Non Contiguous Cells | Excel Discussion (Misc queries) | |||
How do I count non-contiguous cells? | Excel Worksheet Functions | |||
Testing for contiguous cells | Excel Programming |