+ Reply to Thread
Results 1 to 2 of 2

selection.copy - how emulate Paste command?

  1. #1
    topola
    Guest

    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. #2
    Dave Peterson
    Guest

    Re: 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 to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1