With Target.Validation .Delete .Add Type:=0,AlertStyle:=1,Op

问题描述:

With Target.Validation .Delete .Add Type:=0,AlertStyle:=1,Operator:=1 .IMEMode = 1 End With
1个回答 分类:英语 2014-12-15

问题解答:

我来补答
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address <> "$B$1" Then Exit Sub
Dim n,nm,j&,Brr(0 To 3)
nm = Array("1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月")
For i = 0 To 11
If nm(i) = Target.Value Then
Sheets(nm(i)).[i10:i20].Copy [i2]
Sheets(nm(i)).[k10:m12].Copy [k2]
For ii = 0 To 3
For j = i - 3 To i - 1
Brr(ii) = Brr(ii) + Sheets(nm(j)).Cells(ii + 2,3)
Next
Brr(ii) = Brr(ii) / 3
Next
[c7].Resize(4,1) = Application.Transpose(Brr):Exit Sub
End If
Next
End Sub
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim nm
If Target.Address <> "$B$1" Then Exit Sub
nm = Array("4月","5月","6月","7月","8月","9月","10月","11月","12月")
With Target.Validation
.Delete
.Add Type:=xlValidateList,AlertStyle:=xlValidAlertStop,_
Operator:=xlBetween,Formula1:=Join(nm,",")
End With
End Su
 
 
展开全文阅读
剩余:2000