PC Review


Reply
Thread Tools Rate Thread

Autoamate Concatenate Function

 
 
Cheffred
Guest
Posts: n/a
 
      16th Mar 2009
I want to use the Concatenate function below, but I need to use it multiple
times on a large spreadsheet. How can I get Excel to do this automatialcly
based on a particular word in Column a?

Range("A9").Select
Selection.Insert Shift:=xlToRight
ActiveCell.FormulaR1C1 = _
"=CONCATENATE(RC[1],R[1]C[1],R[1]C[2],R[1]C[3],R[1]C[4])"
Selection.Copy
Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone,
SkipBlanks _
:=False, Transpose:=False
Range("B9:J9").Select
Application.CutCopyMode = False
Selection.ClearContents
 
Reply With Quote
 
 
 
 
Jacob Skaria
Guest
Posts: n/a
 
      16th Mar 2009
Dear Cheffred

Use & (ampersand) instead.
Range("E1")=Range("A1") & Range("B1") & Range("C1") & Range("D1")

From VBA if you have more cells use a loop to loop through the range and
concateneate to a variable.

If this post helps click Yes
---------------
Jacob Skaria
 
Reply With Quote
 
Cheffred
Guest
Posts: n/a
 
      16th Mar 2009
That part makes it easier, but what I need is for excel to look through my
spreadsheet and every time col 1 = "machine", for example, to run the
function.

"Jacob Skaria" wrote:

> Dear Cheffred
>
> Use & (ampersand) instead.
> Range("E1")=Range("A1") & Range("B1") & Range("C1") & Range("D1")
>
> From VBA if you have more cells use a loop to loop through the range and
> concateneate to a variable.
>
> If this post helps click Yes
> ---------------
> Jacob Skaria

 
Reply With Quote
 
Jacob Skaria
Guest
Posts: n/a
 
      16th Mar 2009
Please write the code in the below procedure.

Open VBE using Alt+F11, Double click on This Workbook, List Workbook_Sheet
change event and past the below code

Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Range("A1") = "machine" then
Range("E1")=Range("A1") & Range("B1") & Range("C1") & Range("D1")
End If
End Sub


If this post helps click Yes
---------------
Jacob Skaria
 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Concatenate: in an IF Function Tracey Microsoft Excel Worksheet Functions 6 16th Mar 2009 05:13 PM
Using the concatenate function BIAKathy Microsoft Excel Misc 3 8th Jan 2009 11:46 PM
Concatenate Function =?Utf-8?B?TG91?= Microsoft Excel Worksheet Functions 3 18th Oct 2004 02:49 AM
Concatenate Function Jaime Microsoft Access Reports 1 13th Oct 2003 04:10 PM
Concatenate Function anne Microsoft Excel Worksheet Functions 1 18th Jul 2003 12:15 AM


Features
 

Advertising
 

Newsgroups
 


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