Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Add text to existing text string

Using Excel 2000. In a VBA macro, I want to copy the contents of a
cell containing text and add that data to the end of a text string in
the activeCell without overwriting the existing data, then move down 1
row and repeat until a blank cell is found.
I have tried using copy then enter edit mode, but paste is not
available in edit mode.
Is there a bit of code that I can use to accomplish this? Would very
much appreciate your input. William

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 284
Default Add text to existing text string

If the text to be added to the end of the active cell and non empty cells
below is in "A1" then this would do what you're asking.

Sub EditByConcatenation()
Dim rngEdit As Range
Set rngEdit = ActiveCell
Do Until rngEdit.Value = ""
rngEdit.Value = rngEdit.Value & Range("A1").Value
Set rngEdit = rngEdit.Offset(1, 0)
Loop
End Sub


Steve Yandl


"William" wrote in message
ups.com...
Using Excel 2000. In a VBA macro, I want to copy the contents of a
cell containing text and add that data to the end of a text string in
the activeCell without overwriting the existing data, then move down 1
row and repeat until a blank cell is found.
I have tried using copy then enter edit mode, but paste is not
available in edit mode.
Is there a bit of code that I can use to accomplish this? Would very
much appreciate your input. William



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 22,906
Default Add text to existing text string

Or a refinement that allows selecting the start cell for the fill.

Sub Add_Copied_Text()
Dim cell As Range
Dim moretext As String
Dim thirngEdit As Range
Dim rngEdit As Range
'select a cell with text to copy
Set currentSelection = Application.ActiveCell
currentSelection.Name = "oldrange"
moretext = Range("oldrange").Value
'select a cell to start the fill
Set rngEdit = Application.InputBox(prompt:= _
"Select a cell", Type:=8)
Do Until rngEdit.Value = ""
rngEdit.Value = rngEdit.Value & Range("oldrange").Value
Set rngEdit = rngEdit.Offset(1, 0)
Loop
End Sub


Gord Dibben MS Excel MVP

On Sun, 11 Feb 2007 16:26:03 -0800, "Steve Yandl"
wrote:

If the text to be added to the end of the active cell and non empty cells
below is in "A1" then this would do what you're asking.

Sub EditByConcatenation()
Dim rngEdit As Range
Set rngEdit = ActiveCell
Do Until rngEdit.Value = ""
rngEdit.Value = rngEdit.Value & Range("A1").Value
Set rngEdit = rngEdit.Offset(1, 0)
Loop
End Sub


Steve Yandl


"William" wrote in message
oups.com...
Using Excel 2000. In a VBA macro, I want to copy the contents of a
cell containing text and add that data to the end of a text string in
the activeCell without overwriting the existing data, then move down 1
row and repeat until a blank cell is found.
I have tried using copy then enter edit mode, but paste is not
available in edit mode.
Is there a bit of code that I can use to accomplish this? Would very
much appreciate your input. William



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
How do I add text to existing text in a whole column in Excel? Robin Laverick Excel Discussion (Misc queries) 3 July 8th 06 05:07 AM
How do I merge new text into existing text cells. bweiner Excel Discussion (Misc queries) 2 December 12th 05 12:36 AM
replacing text in all cells with existing text plus something avi2001 Excel Discussion (Misc queries) 2 November 2nd 05 04:29 PM
How to input additional text to multiple of existing cells that has text [email protected] Excel Worksheet Functions 2 June 21st 05 01:46 AM
want to remove all text characters equal to one character in length from text string [email protected] Excel Worksheet Functions 1 April 18th 05 12:25 AM


All times are GMT +1. The time now is 09:42 PM.

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"