#### How to identify table data using merged cells?

Sub brent（）

Dim i As Integer, j As Integer
Dim P As Single, P1 As Single, P2 As Single
Dim M As Single, M1 As Single, M2 As Single
Dim inputmat()

nrow = 29
ncol = 2

P = Range("Axial").Value

ReDim inputmat(nrow, ncol)

For i = 1 To nrow
For j = 1 To ncol
inputmat(i, j) = Cells(5 + i, 6 + j)
Next j
Next i
If (P > inputmat(1, 1)) Or (P < inputmat(nrow, 1)) Then Range("PM").Value =
"NG"
Else
For i = 1 To nrow - 1
If (P <= inputmat(i, 1)) And (P >= inputmat(i + 1, 1)) Then
P1 = inputmat(i, 1)
P2 = inputmat(i + 1, 1)
M1 = inputmat(i, 2)
M2 = inputmat(i + 1, 2)
End If
Next i

For i = 1 To nrow

M = M1 + (P - P1) * (M2 - M1) / (P2 - P1)

Next i

Range("PM").Value = M
End If

End Sub

1 个回复

Sub FindMergedCells()

Dim tbl As Range, cll As Range
Dim i As Integer

i = 1
Set tbl = Range("A1:E4")

For Each cll In tbl
If cll.MergeCells Then
Cells(i, 7) = "Cell " & cll.Address & " is merged"

i = i + 1
End If
Next

End Sub
1 使用合并单元格过滤工作表中的数据

2019-05-10 06:38:12 2 31   vba
2 如何使用反应表合并单元格

3 PowerPoint 2007表：识别合并的单元格

5 识别和合并多个单元格

2014-04-24 11:35:44 1 44   vba
6 如何识别数据表的修改单元格？

9 合并填充了 MongoDB 集合数据的表的单元格？

10 在primefaces的数据表中的单元格合并