Thread: Macro Help
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bob Phillips Bob Phillips is offline
external usenet poster
 
Posts: 10,593
Default Macro Help

Try

Sub UnMergeTest()
Dim C As Range, CC As Range
Dim MA As Range, RepeatVal As Variant

For Each C In Range(ActiveCell, Cells(Rows.Count, _
ActiveCell.Column).End(xlUp))
If C.MergeCells = True Then
Set MA = C.MergeArea
If RepeatVal = "" Then RepeatVal = C.Value
MA.MergeCells = False
For Each CC In MA
CC.Value = RepeatVal
Next
End If
RepeatVal = ""
Next
End Sub



--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

"MDMeyers" wrote in message
ups.com...
Using this macro, I get syntax error. Tryng to combine merged cells so
I can graph data.

Sub UnMergeTest()
Dim C As Range, CC As Range
Dim MA As Range, RepeatVal As Variant

For Each C In Range(ActiveCell, Cells(Rows.Count,
ActiveCell.Column).End(xlUp))
If C.MergeCells = True Then
Set MA = C.MergeArea
If RepeatVal = "" Then RepeatVal = C.Value
MA.MergeCells = False
For Each CC In MA
CC.Value = RepeatVal
Next
End If
RepeatVal = ""
Next
End Sub

Thanks in advance for help.