有网友问:如果A1的筛选关键字为“A”,则赋值1给C1,如果为“B”,C1则为2,怎么写
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Dim myt
With Worksheets("sheet1")
If .AutoFilterMode Then
With .AutoFilter.Filters(1)
If .On Then myt = .Criteria1
End With
End If
End With
Select Case myt
Case "=A"
Range("C1") = "1"
Case "=B"
Range("C1") = "2"
End Select
End Sub