VBA Toggle

M

Mokey

I need a bit of code in VBA that will toggle a selection
of cells to merge / unmerge. I wrote Selection.Merge =
Not Selection.Merge, but the error message said that the
object did not support this method. Any help? 'preciate
it!
 
D

Don Guillett

Try

Sub togglemerge()
With Selection
.MergeCells = Not .MergeCells = True
End With
End Sub
 
Top