View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
bdr200 bdr200 is offline
external usenet poster
 
Posts: 2
Default If Statement: How to test if a cell is merged or not?

Hi,
This code checks the activecell to see if it is merged.

Sub TestForMergedCell()
Dim rng As Range

Set rng = ActiveCell

If rng.MergeCells = True Then
MsgBox "Activecell is merged."
Else
MsgBox "Activecell is NOT merged."
End If

End Sub



"Dr. M" wrote:

Hi all! I am looking to do something like this:

If mergecells=True
(then do one thing)
Else
(do something else)
Endif

But I cannot figure out how to get VB to work with my logic. Any ideas?

Thank you!