Skip to content

Instantly share code, notes, and snippets.

@xight
Created July 1, 2015 13:30
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save xight/fefc8da8a2993548d301 to your computer and use it in GitHub Desktop.
Save xight/fefc8da8a2993548d301 to your computer and use it in GitHub Desktop.
find merged cell from worksheets
' usage
' Call("Sheet1", "A1", "Z100")
Sub findMergedCell(strWorkSheet As String, strStartCell As String, strEndCell As String)
Dim cl
Dim msg
Dim rng
rng = strStartCell & ":" & strEndCell
For Each cl In Worksheets(strWorkSheet).Range(rng)
If cl.MergeCells = True Then
If cl.MergeArea(1).Address = cl.Address Then
msg = msg & vbCrLf & cl.Address
End If
End If
Next
MsgBox msg
End Sub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment