Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 1
Default how we can run macro after a written text in a column

we have some written text in column, we want to add a macro that will add
some other text to that column, how we can do this ???
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,646
Default how we can run macro after a written text in a column

You don't mention the source of text to add. If it's a constant string, this
macro adds it to cells in column A:

Sub addtext()
Dim Acell As Range
Addedtext = "texttoadd"
NoOfUsedCells = Range("A" & Rows.Count).End(xlUp).Row
For Each Acell In Range("A1:A" & NoOfUsedCells)
Acell.Value = Acell.Value & Addedtext
Next Acell
End Sub

Regards,
Stefi


€˛rich_jonathan€¯ ezt Ć*rta:

we have some written text in column, we want to add a macro that will add
some other text to that column, how we can do this ???

  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default how we can run macro after a written text in a column

Sub Add_Text()
Dim cell As Range
Dim moretext As String
Dim thisrng As Range
On Error GoTo endit
whichside = InputBox("Left = 1 or Right =2")
Set thisrng = Range(ActiveCell.Address & "," & Selection.Address) _
.SpecialCells(xlCellTypeConstants, xlTextValues)
moretext = InputBox("Enter your Text")
If whichside = 1 Then
For Each cell In thisrng
cell.Value = moretext & cell.Value
Next
Else
For Each cell In thisrng
cell.Value = cell.Value & moretext
Next
End If
Exit Sub
endit:
MsgBox "only formulas in range"
End Sub


Gord Dibben MS Excel MVP

On Thu, 20 Mar 2008 23:46:00 -0700, rich_jonathan
wrote:

we have some written text in column, we want to add a macro that will add
some other text to that column, how we can do this ???


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
Is there a macro or function to convert values to it written text Dang Tran Excel Worksheet Functions 1 April 19th 06 11:17 PM
Create .NET object written in C# in Excel Macro Tom Chau Excel Discussion (Misc queries) 0 April 11th 06 07:38 AM
Create .NET components written in C# inside Excel Macro Tom Chau Excel Discussion (Misc queries) 0 April 11th 06 07:10 AM
I have never written a macro wickd03 Excel Discussion (Misc queries) 2 March 27th 06 05:34 AM
I have never written a macro wickd03 Excel Discussion (Misc queries) 0 March 26th 06 11:42 PM


All times are GMT +1. The time now is 06:01 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"