2016-06-28 2 views

답변

1
Sub Demo() 
    Dim str As String 

    str = "" 

    For Each cel In Range("C1:E5") 
     If Not IsEmpty(cel) Then 
      If str = "" Then 
       str = Range("B" & cel.Row) & "=" & cel.Value 
      Else 
       str = str & ", " & Range("B" & cel.Row) & "=" & cel.Value 
      End If 
     End If 
    Next 

    If str <> "" Then Range("B6") = str 
End Sub 
+0

10Q !, 완벽하게 작동했습니다! – Ash

+0

@Ash - 여러분은 환영합니다. – Mrig

1
Sub test() 

    Dim rng As Range 
    Dim tmp As String 

    Set rng = Range("C1:E5") 

    For Each cell In rng 
     If cell.Value <> "" Then 
      tmp = tmp + " " + Cells(cell.Row, 2).Value + " = " + cell.Value 
     End If 
    Next cell 

    Range("B6").Value = tmp 

End Sub 
+0

10Q!!! – Ash