merging 2 cells without losing data?

  • Thread starter Thread starter bob
  • Start date Start date
Hi Bob

Not possible I'm afraid. Try placing the dat from both cells into one
and use "Center across selection" under Format>Cells>Alignment

Merge cells always end up causing grief. they are best avoided.

***** Posted via: http://www.ozgrid.com
Excel Templates, Training & Add-ins.
Free Excel Forum http://www.ozgrid.com/forum *****
 
Hi Bob
this can only be done with VBA. Try the following macro (which merges
the selection)
Sub merge_cells()
Dim ret_str
Dim rng As Range
Dim cell As Range
Set rng = Selection
For Each cell In rng
If cell.Value <> "" Then
If ret_str = "" Then
ret_str = cell.Value
Else
ret_str = ret_str & Chr(10) & cell.Value
End If
End If
Next
Application.DisplayAlerts = False
With rng
.MergeCells = True
.Value = ret_str
End With
Application.DisplayAlerts = True
End Sub
 
Back
Top