View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
[email protected] tpolak@poczta.onet.pl is offline
external usenet poster
 
Posts: 2
Default selection.copy - how to emulate Paste command?

Hi, this macro concatenates cell contents and displays them in Msgbox
and Debug window.
Now I would like to simply use the result string as a PASTE command.

Do you have any ideas?

Sub Concaten_Cells()
Text = ""
i = 0
ile = Selection.Cells.Count
For Each cell In Selection
i = i + 1
If Text < "" Then
Text = Text & ", " & cell.Text
Else
Text = cell.Text
End If
If i = ile Then
Text = Text & "."
End If
Next
MsgBox Text
Debug.Print Text
End Sub

Thanks, Tomek