How to get find if a cell in excel is merged? If the cell mrged how to read the value?

后端 未结 4 550
日久生厌
日久生厌 2021-01-18 08:20

How do I detect if a cell in excel is merged?

If the cell is merged how do I read the value?

4条回答
  •  小鲜肉
    小鲜肉 (楼主)
    2021-01-18 09:06

    I don't think there's any formula to tell you if a cell is merged or not. You can write your own public vba function, put it in a code Module, and then use that on your sheet:

    Function IsMerged(rCell As Range) As Boolean
    ' Returns true if referenced cell is Merged        
              IsMerged = rCell.MergeCells        
    End Function
    

    Then as an Excel formula to test cell A1:

    =IsMerged(A1)
    

提交回复
热议问题