Merge multiple cells

G

gasma1975

Hi,

I would like to know, how can I merge multiple cells without loosing
the value and have a space between them.

Example: if A1=Text1, if A2=text2, if A3=text3, if A4=text4

Then I select with my mouse A1 to A4 and I apply a merge then I get in
the same cell: text1 text2 Text3 text4

Anyone know how to do such thing ?

Thank you,

Adi,
 
S

Sue Harsevoort

You could create a procedure to do it. I think the following will do what
you want

Sub MergeAndCombine()

Dim curCell As Object
Dim strText As String

For Each curCell In Selection
strText = strText & curCell.Value & " "
curCell.Value = ""
Next

ActiveCell.Value = RTrim(strText)

Selection.HorizontalAlignment = xlCenter
Selection.Merge


End Sub


Sue
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top