|
▼にしもり さん:
>みたいな。
>すみません、むちゃくちゃな聞き方とわかって質問しております。
'---[BB]----------------------------------
' =B1 =P1 =R1
' <>太郎 '=トム
' <>太郎 '=*トム*
'-----------------------------------------
なら、
Sub Try4()
With Range("BB1")
.CurrentRegion.ClearContents
.Range("A1").Formula = "=B1"
.Range("B1").Formula = "=P1"
.Range("C1").Formula = "=R1"
.Range("A2:A3").Value = "<>太郎"
.Range("B2").Value = "'=トム"
.Range("C3").Value = "'=*トム*"
End With
Range("A1").CurrentRegion.AdvancedFilter _
xlFilterInPlace, _
CriteriaRange:=Range("BB1").CurrentRegion
End Sub
'----------------------------------------------------
'[CC1] (空白)
'[CC2] =AND(B2<>"太郎",OR(P2="トム",COUNTIF(R2,"*トム*")>0))
'---------------------------------------------------
なら
Sub Try5()
Dim CR As Range
Set CR = Range("CC1:CC2") '← CriteriaRange
CR.Item(1, 1).ClearContents
CR.Item(2, 1).Value = _
"=AND(B2<>""太郎"",OR(P2=""トム"",COUNTIF(R2,""*トム*"")>0))"
Range("A1").CurrentRegion.AdvancedFilter _
xlFilterInPlace, CriteriaRange:=CR
End Sub
|
|