此主题相关图片如下:00.png

Dim App As New MSExcel.Application
Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\1.xlsx")
Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
Dim Rg As MSExcel.Range = Ws.Range("H1")
If Rg.MergeArea.Address = Rg.Address Then
Output.Show(0)
Else
Dim RowBegin As Integer = Rg.Cells(1).Row
Dim RowEnd As Integer = Rg.Cells(Rg.Count).Row
Output.Show(RowBegin)
Output.Show(RowEnd)
Dim ColumnBegin As Integer = Rg.MergeArea.Cells(1).Column
Dim ColumnEnd As Integer = Rg.Columns.Count
Output.Show(ColumnBegin)
Output.Show(ColumnEnd)
End If
如何知道合并单元格从哪一行到哪一行?从那一列到那一列?