merging 2 cells without losing data?

D

Dave Hawley

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 *****
 
F

Frank Kabel

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
 

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