Merging

  • Thread starter Thread starter Shawn
  • Start date Start date
S

Shawn

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
 
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
 
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
 
Back
Top