| 
    
     |  | じゅんです。 お世話になります。
 
 前回、書かせていただきました、
 >1.「種類」から選んでもらい、その行の初めと終わりを取得。
 >2.「種別」を選んでもらい、その行の初めと終わりを取得。
 >3.「性別」を選んでもらい、その行を取得。
 >4.3.で取得した行から、「値」の値とアドレスを取得。
 を基準にコードが完成しましたので、記載致します。
 本当にそのままでして、また初心者丸出しのコードですが、
 どうぞご勘弁下さい。
 
 Private Sub Result_Click()
 Dim Key1   As String
 Dim Key2   As String
 Dim Key3   As String
 Dim Result  As String
 
 Dim StartRow  As Integer
 Dim EndRow   As Integer
 Dim i      As Integer
 
 'キーワードを取得
 Key1 = Range("G4").Text
 Key2 = Range("H4").Text
 Key3 = Range("I4").Text
 
 '表全体の開始行/終了行を取得
 Range("B3").CurrentRegion.Select
 StartRow = Selection.Item(1).Row
 EndRow = Selection.Item(Selection.Count).Row
 
 'キーワード1(種類)から範囲指定
 For i = StartRow To EndRow
 If Cells(i, "B").Text = Key1 Then
 Cells(i, "B").Select
 StartRow = Selection.Item(1).Row
 EndRow = Selection.Item(Selection.Count).Row
 Exit For
 End If
 Next i
 
 'キーワード2(種別)から範囲指定
 For i = StartRow To EndRow
 If Cells(i, "C").Text = Key2 Then
 Cells(i, "C").Select
 StartRow = Selection.Item(1).Row
 EndRow = Selection.Item(Selection.Count).Row
 Exit For
 End If
 Next i
 
 'キーワード3(性別)から範囲指定
 For i = StartRow To EndRow
 If Cells(i, "D").Text = Key3 Then
 Cells(i, "D").Select
 StartRow = Selection.Item(1).Row
 EndRow = Selection.Item(Selection.Count).Row
 Exit For
 End If
 Next i
 
 '値を取得
 Result = Cells(StartRow, "E").Text
 Range("G7").Value = Result
 
 End Sub
 
 |  |