2、d出框框,在允许下面选择序列,在来源上面填写所需的选择内容,用小写的逗号(,)隔开,例如黄色,红色,绿色,蓝色
3、在F、G列上分别填写颜色及事物,并且要左右一一对应
4、然后在你所需跟着变换的单元格上填写公式(例如D4):=VLOOKUP($C$4,$F:$G,2,0),按回车键
5、然后在C4选择颜色
6、对应的事物就自动在D4中显示出来
在sheet1里增加一个CommandButton1,Alt+F11打开VBE双击左边的sheet1将下面代码复制到中间的代码区.关闭VBE.将CommandButton1结束设计模式即可.如需要请发电邮到[email protected]
Option Explicit
Private Sub CommandButton1_Click()
If CommandButton1.Caption = "Can input" Then
CommandButton1.Caption = "Can NOT input"
Else
CommandButton1.Caption = "Can input"
End If
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim rng As Range
Set rng = Intersect(Target, Range("A1:D10")) 'A1:D10表示一定条件不能编辑的区域.
If rng Is Nothing Then Exit Sub
If CommandButton1.Caption = "Can input" Then
Exit Sub
Else
Range("D11").Select '"D11"表示当选取不能编辑区域时,默认选择储存格.
End If
End Sub
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)