|
こんばんは。
私も作ってみました。
D列を作業列にしました。
'=========================================================
Sub Excel_Search()
Dim rng As Range
Dim f_con(1 To 3) As String
Set rng = Range("a1", Cells(Rows.Count, 1).End(xlUp))
f_con(1) = "=3"
f_con(2) = "=4"
f_con(3) = "=5"
With rng
.Offset(0, 3).Formula = "=IF((RC[-3]" & f_con(1) & ")*(RC[-2]" & f_con(2) & ")*(RC[-1]" & f_con(3) & ")<>0,ROW(),"""")"
.Offset(0, 3).Value = .Offset(0, 3).Value
Set ans = ad_specialcells(.Offset(0, 3))
If Not ans Is Nothing Then
disp = "答えは :" & ans.Count & vbCrLf
For Each cans In ans
disp = disp & cans.Value & "行" & vbCrLf
Next
MsgBox disp
Else
MsgBox "解なし"
End If
.Offset(0, 3).Value = ""
End With
End Sub
'==============================================================
Function ad_specialcells(rng As Range) As Range
On Error Resume Next
Set ad_specialcells = Nothing
Set ad_specialcells = rng.SpecialCells(xlCellTypeConstants)
On Error GoTo 0
End Function
|
|