Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 10-13-2011, 11:15 AM
revans611 revans611 is offline Macro to Insert Text Into Cells Having Multiple Lines Windows Vista Macro to Insert Text Into Cells Having Multiple Lines Office 2007
Novice
Macro to Insert Text Into Cells Having Multiple Lines
 
Join Date: May 2009
Location: Houston, TX
Posts: 9
revans611 is on a distinguished road
Default Macro to Insert Text Into Cells Having Multiple Lines

I need help with a macro to insert copied text to the end of a string of multiple lines that are already in a cell by utilizing the Alt Enter combo.



For example, a cell which already contains the following:

The quick red fox
jumped over


would look like this:

The quick red fox
jumped over
the lazy brown dog.

after I copy "the lazy brown dog." to the clipboard and then click on the cell and press Ctrl i.
Reply With Quote
  #2  
Old 10-13-2011, 10:43 PM
Catalin.B Catalin.B is offline Macro to Insert Text Into Cells Having Multiple Lines Windows Vista Macro to Insert Text Into Cells Having Multiple Lines Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

And you cannot simply double click the cell and just press Ctrl +V instead of Ctrl+I?
Reply With Quote
  #3  
Old 10-14-2011, 04:23 AM
revans611 revans611 is offline Macro to Insert Text Into Cells Having Multiple Lines Windows Vista Macro to Insert Text Into Cells Having Multiple Lines Office 2007
Novice
Macro to Insert Text Into Cells Having Multiple Lines
 
Join Date: May 2009
Location: Houston, TX
Posts: 9
revans611 is on a distinguished road
Default

Double clicking just lets me paste into the cell wherever the cursor happens to be. It does not insert the Alt Enter code to make the new line.

Also, I need a macro because I am going to modify it with additional VBA code.
Reply With Quote
  #4  
Old 10-14-2011, 10:10 AM
Catalin.B Catalin.B is offline Macro to Insert Text Into Cells Having Multiple Lines Windows Vista Macro to Insert Text Into Cells Having Multiple Lines Office 2010 32bit
Expert
 
Join Date: May 2011
Location: Iaşi, Romānia
Posts: 386
Catalin.B is on a distinguished road
Default

Try this code then... (you need to set a reference to the Microsoft Forms 2.0 Object Library... To add a reference to your VBA project, go to the Tools menu in the VBA editor and choose the References item. In the dialog that appears, scroll down the list until you find the appropriate library )
Code:
Sub paste()
Dim DataObj As New MSForms.DataObject
    Dim S, T As String
    DataObj.GetFromClipboard
    T = ActiveCell.Value
    
    S = DataObj.GetText
   
ActiveCell.Value = T & " " & S
End Sub
Reply With Quote
  #5  
Old 10-24-2011, 10:15 AM
revans611 revans611 is offline Macro to Insert Text Into Cells Having Multiple Lines Windows Vista Macro to Insert Text Into Cells Having Multiple Lines Office 2007
Novice
Macro to Insert Text Into Cells Having Multiple Lines
 
Join Date: May 2009
Location: Houston, TX
Posts: 9
revans611 is on a distinguished road
Default

Thank you for the reply. So how would I insert the "Alt Enter" to force a new line?
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Insert a Clear, Blank page without Lines and Numbers in a Pleading Document Dirigo Word 5 09-30-2011 08:08 AM
Macro to Insert Text Into Cells Having Multiple Lines Multiple VLOOKUP's checking multiple Cells OTPM Excel 11 05-23-2011 11:18 AM
Macro to Insert Text Into Cells Having Multiple Lines filling multiple cells whislt using Filter VinceO Excel 1 05-09-2011 06:38 AM
Macro to Insert Text Into Cells Having Multiple Lines How to organize and insert blank cells between a huge number of data? tareq Excel 12 09-29-2010 02:12 PM
Macro to Insert Text Into Cells Having Multiple Lines Horizontal lines won't insert into full margins set in a doc. rec Outlook 2 06-14-2010 09:47 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 12:25 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft