【发布时间】:2016-06-28 12:39:49
【问题描述】:
【问题讨论】:
【问题讨论】:
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
【讨论】:
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
【讨论】: