|
楼主 |
发表于 2018-7-25 21:06
|
显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Parent.Range("A" & Target.Row) = "" Then
Exit Sub
End If
If Target.Column = 4 And 1 < Target.Row Then
If Target.Parent.Range("D" & Target.Row) = "" Then
On Error Resume Next
Dim y, x, t,j
y = ActiveCell.Row
j = 0
x = Mid(Cells(y, 1), 5, 4) & Cells(y, 2) & Right(Cells(y, 3), 5)
For i = 2 To y
If Mid(Cells(i, 1), 5, 4) & Cells(i, 2) & Right(Cells(i, 3), 5) = x Then
j = j + 1
End If
Next
t = j
With wbqqw
.TextBox1.Text = t
.Show
End With
Err.Clear
End If
End If
Exit Sub
End Sub
|
|