With Target.Validation .Delete .Add Type:=0,AlertStyle:=1,Operator:=1 .IMEMode = 1 End With
来源:学生作业帮助网 编辑:作业帮 时间:2024/11/30 20:15:23
With Target.Validation .Delete .Add Type:=0,AlertStyle:=1,Operator:=1 .IMEMode = 1 End With
With Target.Validation .Delete .Add Type:=0,AlertStyle:=1,Operator:=1 .IMEMode = 1 End With
With Target.Validation .Delete .Add Type:=0,AlertStyle:=1,Operator:=1 .IMEMode = 1 End With
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 Sub