Copy and paste from column without quotations on carriage return.

Tazyote

New Member
Joined
Jan 14, 2014
Messages
14
I have several textboxes with buttons that populate several cells in a single column and then copies that column so that I can then paste the contents into a seperate company data entry program that is web based. I have enabled the enter key (for carriage returns) in the textboxes so that paragraphs can be written. However, if the return button is used in a text box, it translates over to the assigned cell as if I had selected <alt enter>. Therefore, whenever I paste it into the web based program, annoying quotation marks show up around the data in that cell when the column is copied.

This can be duplicated by entering text into any cell and using the <alt enter> function at some point. If you copy and paste it into Microsoft Notepad, you will see the unwanted quotation marks I am talking about. I have found code that eliminates this for individual cells, but I cannot figure out how to adapt it for the entire column. I have attached the macro I found below.

The issue is in line 4 where it uses 'ActiveCell.Text'. This only allows the text for the first cell in the column to be copied. I need the entire column. I have tried many variations without success. I was wondering if any of you know the proper code to select the entire column. It is probably an easy solution but it has me scratching my nogin.

Code:
 Option Explicit
 Sub testme()

 Dim MyDataObj As DataObject
 Set MyDataObj = New DataObject

 MyDataObj.SetText ActiveCell.Text
 MyDataObj.PutInClipboard

End Sub
 

Excel Facts

Using Function Arguments with nested formulas
If writing INDEX in Func. Arguments, type MATCH(. Use the mouse to click inside MATCH in the formula bar. Dialog switches to MATCH.
I found another way to solve this issue by running the column through Word first. I am posting my solution in the event any of you find it useful. Thanks

Code:
Sub CopyToWord()
  Dim objWord As Object
    Set objWord = CreateObject("Word.Application")
  'Copy the range Which you want to paste in a New Word Document
    Range("D:D").Copy
    
    With objWord
        .Documents.Add
        .Selection.Paste
        .Visible = False
        .Selection.WholeStory
        .Selection.Copy
        .Quit SaveChanges:=False
    End With

End Sub
 
Upvote 0

Forum statistics

Threads
1,214,385
Messages
6,119,210
Members
448,874
Latest member
b1step2far

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top