一个单元格的多选项(区别有效性序列)

来源:百度文库 编辑:神马文学网 时间:2024/04/29 06:37:48
一个单元格的多选项(区别有效性序列) 

 

相关实现的代码:

Private Sub CommandButton1_Click()
If ActiveCell.Column = 2 Or ActiveCell.Column = 4 Then
ActiveCell = ""
End If
End Sub

Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column = 2 Or Target.Column = 4 Then
UserForm1.Show
End If
End Sub

窗体代码:

Private Sub ListBox1_Click()
Dim myTEXT
myTEXT = ActiveCell.Formula
ActiveCell = myTEXT & " " & UserForm1.ListBox1.Value
End Sub

动画示例: