Hello,
I'm trying to write a few useful macros to help myself learn vba.
I've tried here to write some code that will determine whether or not the previously selected cells are merged, if they aren't then the cells should be merged together, if they are already then they should be unmerged.
Below is what I have so far, but I'm having difficulty finding the right expression for the IF statement, any tips for this would be appreciated!
I'm trying to write a few useful macros to help myself learn vba.
I've tried here to write some code that will determine whether or not the previously selected cells are merged, if they aren't then the cells should be merged together, if they are already then they should be unmerged.
Below is what I have so far, but I'm having difficulty finding the right expression for the IF statement, any tips for this would be appreciated!
Sub Merge()
'
' Merge Macro
'
' Keyboard Shortcut: Ctrl+m
'
If ???????? = True Then
With Selection
.MergeCells = False
End With
Else
With Selection
.MergeCells = True
.WrapText = True
End With
End If
End Sub