Merging  
Author Message
comick





PostPosted: Wed Apr 07 15:02:59 CDT 2004 Top

Excel Misc >> Merging

Hi, I have to columns of data A and B
I want to merge them together. When I merge and center
them I get a popup that says "This selection contains
multiple data values, Merging into one cell will keep the
upperleft most data" How do I get around that.

Also can I put a dash "-" inbetween them

A B This is what I want it to look like

1 3/1/2004 1 - 3/1/2004

Excel477  
 
 
mzehr





PostPosted: Wed Apr 07 15:02:59 CDT 2004 Top

Excel Misc >> Merging The fastest way is to use a helper column c
in c1 use the formula = a1 & "-" &b1
copy that formula down, then if you want copy it and paste
the values where you want them

HTH
>-----Original Message-----
>Hi, I have to columns of data A and B
>I want to merge them together. When I merge and center
>them I get a popup that says "This selection contains
>multiple data values, Merging into one cell will keep the
>upperleft most data" How do I get around that.
>
>Also can I put a dash "-" inbetween them
>
>A B This is what I want it to look like
>
>1 3/1/2004 1 - 3/1/2004
>.
>
 
 
Frank





PostPosted: Wed Apr 07 17:19:32 CDT 2004 Top

Excel Misc >> Merging Hi
one way:using 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 & "-" & cell.Value
End If
End If
Next
Application.DisplayAlerts = False
With rng
.MergeCells = True
.Value = ret_str
End With
Application.DisplayAlerts = True
End Sub

this merges your selection
--
Regards
Frank Kabel
Frankfurt, Germany



> Hi, I have to columns of data A and B
> I want to merge them together. When I merge and center
> them I get a popup that says "This selection contains
> multiple data values, Merging into one cell will keep the
> upperleft most data" How do I get around that.
>
> Also can I put a dash "-" inbetween them
>
> A B This is what I want it to look like
>
> 1 3/1/2004 1 - 3/1/2004