Macro Help
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. |
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. |
All times are GMT +1. The time now is 04:30 AM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com