close

Here is the macro that concatenates the cells contents in one string.
I've manage to display the result in MsgBox. Now I would like to be
able to use it as a quot;PASTEquot; command. Do you have any ideas?

Sub Macro1()
Result = quot;quot;
For Each cell In Selection
Result = Result amp; quot; quot; amp; cell.Text
Next
MsgBox Result
End Sub

Tnkx in advance, tpHow about just plopping that value into the cell you want.

Sub Macro1()
Dim Result as String
dim Cell as Range

Result = quot;quot;
For Each cell In Selection
Result = Result amp; quot; quot; amp; cell.Text
Next cell

'MsgBox Result

Activesheet.range(quot;a1quot;).value = Result

End Sub

(I like to declare my variables.)

topola wrote:
gt;
gt; Here is the macro that concatenates the cells contents in one string.
gt; I've manage to display the result in MsgBox. Now I would like to be
gt; able to use it as a quot;PASTEquot; command. Do you have any ideas?
gt;
gt; Sub Macro1()
gt; Result = quot;quot;
gt; For Each cell In Selection
gt; Result = Result amp; quot; quot; amp; cell.Text
gt; Next
gt; MsgBox Result
gt; End Sub
gt;
gt; Tnkx in advance, tp

--

Dave Peterson

全站熱搜
創作者介紹
創作者 software 的頭像
software

software

software 發表在 痞客邦 留言(0) 人氣()