| 
    
     |  | ▼トウジ さん: 
 >Do
 >
 >x = i - 1
 >y = x + 5
 >
 >If (h1 <= Sheets(1).Cells(i, "W") And Sheets(1).Cells(i, "W") <= h2) And
 >(j1 <= Sheets(1).Cells(i, "X") And Sheets(1).Cells(i, "X") <= j2) And
 >(k1 <= Sheets(1).Cells(i, "Y") And Sheets(1).Cells(i, "Y") <= k2) And
 >(l1 <= Sheets(1).Cells(i, "Z") And Sheets(1).Cells(i, "Z") <= l2) And
 >(m1 <= Sheets(1).Cells(i, "AA") And Sheets(1).Cells(i, "AA") <= m2) And
 >(n1 <= Sheets(1).Cells(i, "AB") And Sheets(1).Cells(i, "AB") <= n2) And
 >(o1 <= Sheets(1).Cells(i, "AC") And Sheets(1).Cells(i, "AC") <= o2) And
 >(p1 <= Sheets(1).Cells(i, "AD") And Sheets(1).Cells(i, "AD") <= p2) And
 >(q1 <= Sheets(1).Cells(i, "AE") And Sheets(1).Cells(i, "AE") <= q2) Then
 >
 >Else
 >Sheets(1).Rows(x & ":" & y).Hidden = True '表示しない 行(i-x)から行((i+5)-x)"
 >End If
 >i = i + 6
 >Loop Until Sheets(1).Cells(i, "D").Value = ""
 >
 >----------------------------------------------------------------
 >入力した条件に当てはまっていても、
 >Sheets(1).Rows(x & ":" & y).Hidden = True となり
 >行が非表示となってしまいます。なぜでしょうか?
 
 こちらでは(データを作り難く)検証がむつかしいので、
 うえの部分を以下のように修正して、
 イミディエイト・ウィンドウでどの列で条件外となっているか
 確かめてください。
 With Sheets(1)
 For i = 3 To .Cells(.Rows.Count, 4).End(xlUp).Row Step 6
 x = i - 1
 y = i + 4
 .Rows(x & ":" & y).Hidden = True '表示しない 行(i-x)から行((i+5)-x)"
 Select Case False
 Case .Cells(i, "W") >= h1: Debug.Print "[W" & i & "] not(>=h1)"
 Case .Cells(i, "W") <= h2: Debug.Print "[W" & i & "] not(<=h2)"
 Case .Cells(i, "X") >= j1: Debug.Print "[X" & i & "] not(>=j1)"
 Case .Cells(i, "X") <= j2: Debug.Print "[X" & i & "] not(>=j2)"
 Case .Cells(i, "Y") >= k1: Debug.Print "[Y" & i & "] not(>=k1)"
 Case .Cells(i, "Y") <= k2: Debug.Print "[Y" & i & "] not(>=k2)"
 Case .Cells(i, "Z") >= l1: Debug.Print "[Z" & i & "] not(>=L1)"
 Case .Cells(i, "Z") <= l2: Debug.Print "[Z" & i & "] not(>=L2)"
 Case .Cells(i, "AA") >= m1: Debug.? "[AA" & i & "] not(>=m1)"
 Case .Cells(i, "AA") <= m2: Debug.? "[AA" & i & "] not(>=m2)"
 Case .Cells(i, "AB") >= n1: Debug.? "[AB" & i & "] not(>=n1)"
 Case .Cells(i, "AB") <= n2: Debug.? "[AB" & i & "] not(>=n2)"
 Case .Cells(i, "AC") >= o1: Debug.? "[AC" & i & "] not(>=o1)"
 Case .Cells(i, "AC") <= o2: Debug.? "[AC" & i & "] not(>=o2)"
 Case .Cells(i, "AD") >= p1: Debug.? "[AD" & i & "] not(>=p1)"
 Case .Cells(i, "AD") <= p2: Debug.? "[AD" & i & "] not(>=p2)"
 Case .Cells(i, "AE") >= q1: Debug.? "[AE" & i & "] not(>=q1)"
 Case .Cells(i, "AE") <= q2: Debug.? "[AE" & i & "] not(>=q2)"
 Case Else
 .Rows(x & ":" & y).Hidden = False
 End Select
 Next
 End With
 
 |  |