#1   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Text Functions

Can I have text from cells in one coloumn automatically added to the
beginning of anything that is typed in the same row of another coloumn?
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 22,906
Default Text Functions

You could use a formula and helper column

A1 contains "this is"

In C1 enter this formula =A1 & " " B1 Note: the " " adds a space.

In B1 type "combined text"

C1 will return "this is combined text"

To have it happen without a formula you would need VBA event code.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo endit
If Target.Column = 2 Then
Application.EnableEvents = False
With Target
.Value = .Offset(0, -1).Value & " " & .Value
End With
End If
endit:
Application.EnableEvents = True
End Sub

When you type text in column B then hit enter, that text will be prefaced by the
text in Column A

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that sheet module. Alt + q to go back to Excel window.


Gord Dibben MS Excel MVP


On Sat, 2 Feb 2008 18:04:01 -0800, wilson o
wrote:

Can I have text from cells in one coloumn automatically added to the
beginning of anything that is typed in the same row of another coloumn?


  #3   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2
Default Text Functions

Thank you.

"Gord Dibben" wrote:

You could use a formula and helper column

A1 contains "this is"

In C1 enter this formula =A1 & " " B1 Note: the " " adds a space.

In B1 type "combined text"

C1 will return "this is combined text"

To have it happen without a formula you would need VBA event code.

Private Sub Worksheet_Change(ByVal Target As Range)
On Error GoTo endit
If Target.Column = 2 Then
Application.EnableEvents = False
With Target
.Value = .Offset(0, -1).Value & " " & .Value
End With
End If
endit:
Application.EnableEvents = True
End Sub

When you type text in column B then hit enter, that text will be prefaced by the
text in Column A

This is sheet event code. Right-click on the sheet tab and "View Code"

Copy/paste into that sheet module. Alt + q to go back to Excel window.


Gord Dibben MS Excel MVP


On Sat, 2 Feb 2008 18:04:01 -0800, wilson o
wrote:

Can I have text from cells in one coloumn automatically added to the
beginning of anything that is typed in the same row of another coloumn?



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
Fun with text functions - search for text mr tom Excel Worksheet Functions 7 October 26th 07 07:17 PM
Formatting text within functions jasonr17 Excel Worksheet Functions 3 September 20th 07 05:28 PM
wanted help about text functions sagiraju Excel Worksheet Functions 2 March 23rd 06 05:44 PM
#N/A is not text, cannot use it in functions R-P Excel Worksheet Functions 3 November 22nd 05 04:07 PM
Text Functions, Lowell Excel Worksheet Functions 8 September 24th 05 09:14 AM


All times are GMT +1. The time now is 01:31 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"