|
发表于 2013-11-29 22:50
|
显示全部楼层
本楼为最佳答案
本帖最后由 xdragon 于 2013-11-29 23:06 编辑
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Address = Range("A1").Address And [a1] = "" Then [a1].Validation.Delete
- End Sub
- Private Sub Worksheet_SelectionChange(ByVal Target As Range)
- Dim i As Integer, str As String
- If Target.Address = Range("A1").Address Then
- ' If [a1] <> "" And Right([a1].Value, 1) > "9" Then '如果已经选择了的,不需要再次添加数字组合的请用这个哈
- If [a1] <> "" Then
- For i = 1 To 6
- str = str & "," & [a1].Value & i
- Next
- With [a1].Validation
- .Delete
- .Add Type:=xlValidateList, AlertStyle:=xlValidAlertStop, Formula1:=Mid(str, 2)
- End With
- End If
- End If
- End Sub
复制代码 楼主你看看这个是不是你需要的呢? |
|