|    | 
     こんばんは 
 
良く分かりません。 
 
>文字列A:N20,(Z-2.4),N20,(Z-5.0),N30,(Z-2.4),N30,(Z-5.0) 
それぞれのナンバーと値は交互に並んでいますか? 
 
>規則は、それぞれのナンバーの最大マイナス値になります。 
>N20の最大マイナスは(Z-5)で、N30の最大マイナスも(Z-5) 
値は「(Z」括弧+英字1文字の後にマイナス値で、括弧閉じる。 
でしょうか? 
 
  Dim i   As Long 
  Dim m1Dic As Object 
  Dim V   As Variant 
  Dim tmp  As String 
  Dim B   As String 
  Dim o   As Variant 
   
  tmp = "N20,(Z-2.4),N20,(Z-5.0),N30,(Z-2.4),N30,(Z-5.0)" 
   
  V = Split(tmp, ",") 
   
  Set m1Dic = CreateObject("Scripting.Dictionary") 
  For i = LBound(V) To UBound(V) Step 2 
    If Not IsEmpty(V(i)) Then 
      If Not m1Dic.Exists(V(i)) Then 
        m1Dic(V(i)) = V(i + 1) 
      Else 
        If Val(Replace(Mid(m1Dic(V(i)), 3), ")", "")) > _ 
          Val(Replace(Mid(V(i + 1), 3), ")", "")) Then 
          m1Dic(V(i)) = V(i + 1) 
        End If 
      End If 
    End If 
  Next 
  o = m1Dic.keys 
  For i = 0 To m1Dic.Count - 1 
    If B = "" Then 
      B = o(i) & "," & m1Dic(o(i)) 
    Else 
      B = B & "," & o(i) & "," & m1Dic(o(i)) 
    End If 
  Next 
 
  MsgBox B 
   
  Set m1Dic = Nothing 
 
 | 
     
    
   |