shortcut key for cell concatenation

  • Thread starter Thread starter hal9000
  • Start date Start date
H

hal9000

is there any shortcut key for cell concatenation?
if there's none, then is there any way to create
shortcut keys on your own?
 
would you tell me the macro for cell concatenation?
i mean i'd like to merge cell a1 and cell b1 and
make it as a large cell a1.
 
i've made on my own; merges selected cell.
Sub CellMerge()
'
With Selection
If .MergeCells = False Then
.MergeCells = True
.HorizontalAlignment = xlCenter
Else
.MergeCells = False
End If
End With
'
End Sub
 
Added code will put the values in the cells as a concatenated string in the
upper left cell of the selection. If you want a space between entries you
can do
sStr = Trim(sStr) & " " & cell.Value


Sub CellMerge()
'

Dim cell as Range, sStr as String
If Selection.MergeCells = False then
for each cell in selection
sStr = sStr & cell.Value
cell.ClearContents
Next
selection(1,1).Value = sStr
End if

With Selection


If .MergeCells = False Then
.MergeCells = True
.HorizontalAlignment = xlCenter
Else
.MergeCells = False
End If
End With
'
End Sub
 
Back
Top