CONCATENATE usage

Neitrino

New Member
Joined
Aug 13, 2011
Messages
10
Hello,

I have two question

1) I have a huge column... and I want contents of each cell to be taken and put in one single cell .... how can I employ the "concatenate" function to select huge range ?

2) How do I add some certain character to the end of each cell in range?
For example is I have: text1, text2, text3 and I want to get text1A, text2A, text 3A and etc...

Thanks :)
 

Excel Facts

Excel Joke
Why can't spreadsheets drive cars? They crash too often!
Use the following UDF:

Code:
Function ConcatSpecial(r As Range, delimiter As String, Optional appendchar As String) As String
Dim c As Range, s As String
For Each c In r
    If c <> "" Then s = s & c & appendchar & delimiter
Next
s = Trim(s)
ConcatSpecial = Left(s, Len(s) - 1)
End Function

Then in the spreadsheet, you can do something like this:

=ConcatSpecial(A1:A1000,", ")

which will concatenate the values of A1:A1000 separated by a comma and a space.

To add a character(s) to each string, use the same function, but add the append character to the end of the formula:

=ConcatSpecial(A1:A1000,", ","A")
 
Upvote 0
Dear Hotpepper,

Thanks for ur help it was just great and it saved me making time consuming typing... may u please advise me some book to learn that stuff, I have no idea of programming so some simple book for dummies... to learn quickly in short time...


Thanks much
 
Upvote 0
Don't have any book recommendations, but there is a book called
Excel VBA Programming For Dummies
 
Upvote 0
Dear Hotpepper,
Pls advise me what I do wrong....

Function CellA1equals15()
Range("A1") = "15"
End Function

Wherever I shall type function CellA1equals15 I want that in cell A1 number fifteen to appear... but it doesnt waork

I hit my head against the wall pls advise

Thank you
 
Upvote 0
Functions can't return values to other cells. You need to run a regular macro for that.

Code:
Sub A1equals15
Range("A1")=15
End Sub
 
Upvote 0
Dear Hotpepper,

In your scrip you type: Dim c As Range... whats the diffrerence in you had stated just c As Range and why this Dim c As Range isout parenthesis?


Thank you
 
Upvote 0
Dear Hotpepper,
I am sorry if I bother you with my questions but seems with your help I am getting into the drill.....

So next question: as I understand there are Objects, Obejcts can have properties (Object property) and Objects can have methods (Object method) and when I want to assign a method or property to a object i write them together but dot is used between them:

Range("A1").Value or Range("A1") .ClearContents for example.

And basically whole VBA (at least bulk of VBA in excel) job is operation with these three items.

Where can i find the list of all Objects, Object properties and Object methods which already exisit and thoese will be bricks for my VBA code?

Thanks very much :)
 
Upvote 0

Forum statistics

Threads
1,224,541
Messages
6,179,418
Members
452,912
Latest member
alicemil

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top