Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Sign In with Facebook Sign In with Google Sign In with OpenID

Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

Macro that copy a cell but always adds an extra charachter??

mchateaumchateau Posts: 1Member
Anybody please tell me how to use the activecell.copy or similar to copy the content of the cell without having Excel adding an cariage character mistiriously? It shows when I use CTR-V to paste into another program. If I copy and pase manually from the cell it is fine, but using the macro it is simply adding an extra character!!

Comments

  • markycmarkyc Posts: 11Member
    : Anybody please tell me how to use the activecell.copy or similar to copy the content of the cell without having Excel adding an cariage character mistiriously? It shows when I use CTR-V to paste into another program. If I copy and pase manually from the cell it is fine, but using the macro it is simply adding an extra character!!
    :

    I see what you mean.
    What you could do is in VBA insert a new UserForm and insert the following code:

    Public Sub MyCopy()
    Dim MyObj As New DataObject
    MyObj.SetText ActiveCell.Value
    MyObj.PutInClipboard
    End Sub

    Then insert a new Module with the following code:

    Public Sub CallMyCopy()
    UserForm1.MyCopy
    End Sub

    Then you can setup your shortcut key to use CallMyCopy. Make sure the first code is put in the UserForm since the DataObject object is in the MSForms 2.0 Library.
    [blue][size=4][b]markyc[/b][/size][/blue]
    [grey][size=2]
    I made a new friend today.
    Real or imaginary?
    Imaginary.
    [/size][/grey]

Sign In or Register to comment.