Home |
Search |
Today's Posts |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Sub SetCells()
ActiveSheet.Unprotect Password:="ABC" Set rng = Range(Cells(1, 2), Cells(Rows.Count, 2).End(xlUp)) For Each cell In rng If IsNumeric(cell.Value) Then cell.Resize(1, cell.Value).Locked = True End If Next ActiveSheet.EnableSelection = xlUnlockedCells ActiveSheet.Protect Password:="ABC" End Sub the default state for cells is locked, so if you want all other cells selectable Sub SetCells() ActiveSheet.Unprotect Password:="ABC" Cells.Locked = false Set rng = Range(Cells(1, 2), Cells(Rows.Count, 2).End(xlUp)) For Each cell In rng If IsNumeric(cell.Value) Then cell.Resize(1, cell.Value).Locked = True End If Next ActiveSheet.EnableSelection = xlUnlockedCells ActiveSheet.Protect Password:="ABC" End Sub -- Regards, Tom Ogilvy wrote in message ps.com... Here is what I was looking for Suppose Cell B1= 2 , then I wanted to cells C1 and D1 to be blank and locked ( Locked in the sence, no one should be able to write in those cell. They should be as good as merged cell where I can't even blink my cursor) So depending on the values of the cell in column B, I wanted to make the equivalenmt cells in that row as dead locked. Suppose B1 = 3 then C1 D1 and E1 should be dead locked. Suppose B2 = 4 then C2, D2, E2 and F2 should be dead locked. Dead locked means no one should be able to write in nor format those cell. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Excel +won't +merge cells in a column. Is my formatting blocking . | New Users to Excel | |||
Excel 2007 conditional format and merge cells | Excel Discussion (Misc queries) | |||
Conditional formatting with multiple, non-consecutive values?? | Excel Discussion (Misc queries) | |||
conditional formatting consecutive cells | Excel Worksheet Functions | |||
Conditional formatting on Consecutive cells | Excel Worksheet Functions |