EXCEL中部分表格浏览权限
答案:2 悬赏:30 手机版
解决时间 2021-04-07 10:16
- 提问者网友:姑娘长的好罪过
- 2021-04-06 16:10
在一份表格中,例如我只想部分人看到A1到A10噶格子。其他的看不到。而老板就可以全部都看得到。需要怎样设置。
最佳答案
- 五星知识达人网友:风格不统一
- 2021-04-06 16:57
选中A1:A10,鼠标右击,“设置单元格格式”,“保护”,去掉“锁定”的钩,设置除了A1:A10之外的单元格字体颜色为白色
菜单栏,工具,保护,保护工作表,去掉“选定锁定的单元格”输入密码,确认密码,确定
这样,除了有密码的人,其他人只能看见A1到A10噶格的内容
菜单栏,工具,保护,保护工作表,去掉“选定锁定的单元格”输入密码,确认密码,确定
这样,除了有密码的人,其他人只能看见A1到A10噶格的内容
全部回答
- 1楼网友:廢物販賣機
- 2021-04-06 18:33
说明:登陆帐号和密码事先存入sheet2工作表,administrator帐号可以新增,删除,修改,帐号,密码,权限
权限为A的可以看到全部数据,权限为B的隐藏A列的数据.当然,要看什麽数据,要隐藏什麽数据,可以自己设定.
Private Sub Workbook_Open()
Sheet2.Visible = False
Sheet1.Visible = False
zhanghao = Trim(InputBox("please enter your accounts", "heihei prompt"))
mima = Trim(InputBox("please enter your password", "heihei prompt"))
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
With cnn
.Provider = "microsoft.jet.oledb.4.0"
.ConnectionString = "Extended Properties=Excel 5.0;" + "Data Source=" + ThisWorkbook.Path + "\ERP.xls"
.Open
End With
Set rs = New ADODB.Recordset
Sql = "select accounts,password,popedom From [Sheet2$] where accounts='" + zhanghao + "' and password='" + mima + "'"
rs.Open Sql, cnn, adOpenKeyset, adLockBatchOptimistic
If rs.RecordCount > 0 Then
If rs.Fields("accounts") = "administrator" Then
Sheet2.Visible = True
Sheet2.Select
...说明:登陆帐号和密码事先存入sheet2工作表,administrator帐号可以新增,删除,修改,帐号,密码,权限
权限为A的可以看到全部数据,权限为B的隐藏A列的数据.当然,要看什麽数据,要隐藏什麽数据,可以自己设定.
Private Sub Workbook_Open()
Sheet2.Visible = False
Sheet1.Visible = False
zhanghao = Trim(InputBox("please enter your accounts", "heihei prompt"))
mima = Trim(InputBox("please enter your password", "heihei prompt"))
Dim cnn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cnn = New ADODB.Connection
With cnn
.Provider = "microsoft.jet.oledb.4.0"
.ConnectionString = "Extended Properties=Excel 5.0;" + "Data Source=" + ThisWorkbook.Path + "\ERP.xls"
.Open
End With
Set rs = New ADODB.Recordset
Sql = "select accounts,password,popedom From [Sheet2$] where accounts='" + zhanghao + "' and password='" + mima + "'"
rs.Open Sql, cnn, adOpenKeyset, adLockBatchOptimistic
If rs.RecordCount > 0 Then
If rs.Fields("accounts") = "administrator" Then
Sheet2.Visible = True
Sheet2.Select
End If
If rs.Fields("popedom") = "A" Then
Sheet1.Visible = True
Sheet1.Select
Range("A:A").Select
Selection.EntireColumn.Hidden = False
Range("A1").Select
End If
If rs.Fields("popedom") = "B" Then
Sheet1.Visible = True
Sheet1.Select
Range("A:A").Select
Selection.EntireColumn.Hidden = True
Range("B1").Select
End If
Else
x = MsgBox("accounts or password error:", vbOKOnly + vbInformation, "heihei prompt")
Application.Quit
End If
rs.Close
cnn.Close
Set rs = Nothing
Set cnn = Nothing
End Sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯