VBA Toggle

  • Thread starter Thread starter Mokey
  • Start date Start date
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!
 
Try

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top