selection.copy - how to emulate Paste command?

  • Thread starter Thread starter tpolak
  • Start date Start date
T

tpolak

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
 
I think you will have to write the variable "TEXT" to a cell first.

After that you can copy and paste the cell value value or simply continue to
write "TEXT" to where it is required.

N10
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top