Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
topola
 
Posts: n/a
Default selection.copy - how emulate Paste command?

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 "PASTE" command. Do you have any ideas?

Sub Macro1()
Result = ""
For Each cell In Selection
Result = Result & " " & cell.Text
Next
MsgBox Result
End Sub

Tnkx in advance, tp

  #2   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson
 
Posts: n/a
Default selection.copy - how emulate Paste command?

How about just plopping that value into the cell you want.

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

Result = ""
For Each cell In Selection
Result = Result & " " & cell.Text
Next cell

'MsgBox Result

Activesheet.range("a1").value = Result

End Sub

(I like to declare my variables.)

topola wrote:

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 "PASTE" command. Do you have any ideas?

Sub Macro1()
Result = ""
For Each cell In Selection
Result = Result & " " & cell.Text
Next
MsgBox Result
End Sub

Tnkx in advance, tp


--

Dave Peterson
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macro to Copy & Paste in backgorund Alarmbloke Excel Discussion (Misc queries) 9 January 8th 09 10:33 PM
paste command not work in 'comment' CoolKerala Excel Discussion (Misc queries) 2 June 4th 05 12:44 PM
How do I add a command button on a worksheet to "paste" from the . [email protected] Excel Worksheet Functions 3 March 13th 05 06:25 PM
How do I add a command button on a worksheet to "paste" from the . Jalifid Excel Worksheet Functions 0 March 13th 05 03:01 PM
link data to new workbook WYN Excel Discussion (Misc queries) 3 February 28th 05 06:19 AM


All times are GMT +1. The time now is 09:49 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"