View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Eddy Stan Eddy Stan is offline
external usenet poster
 
Posts: 151
Default Locking specific cells

HI
i posted a query already - please ignore that.

In a data entry sheet
column b has dates and B3 has specific date
i like to lock adjacent cells in columns F,G & H
if the date in column B is not date in B3 (criteria)
further should not allow to delete anyrow when there is value in cells of
F,G & H columns. if there is no value then those can be deleted.

sub Worksheet_Change(ByVal Target As Range)

if cell(b column) = $B$3 then
activesheet.unprotect ="hi"
cell.("F"&row).locked = false
cell.("G"&row).locked = false
cell.("h"&row).locked = false

else
activesheet.unprotect ="hi"
cell.("F"&row).locked = true
cell.("G"&row).locked = true
cell.("h"&row).locked = true
endif

activesheet.protect ="hi"

end sub