赞
踩
用此法好, 不用select方法(会导致丢光标位置)
With ThisWorkbook.Worksheets("检查信息")
ActiveSheet.Unprotect
AutoFilterMode = False '自动筛选
Rows(1).AutoFilter
Cells.Locked = False '序列号锁定
Set rg = .Range("A1:A" & iNum + 100)
For Each cell In rg
cell.Locked = True
Next
ActiveSheet.Protect DrawingObjects:=True, Contents:=True, Scenarios:=True _
, AllowInsertingRows:=True, AllowFiltering:=True
在修改锁定的单元格前,要先把保护去掉.
With ThisWorkbook.Worksheets("检查信息")
ActiveSheet.Unprotect
改完单元格内容以后,
先设定Cells.Locked=False
再用select选中要锁定的范围,可以是Range, Columns,
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。