|
- Sub 提取()
- Dim min%, max%
- min = Split([bh1], "~")(0) '获取最小值
- max = Split([bh1], "~")(1) '获取最大值
- Dim rng As Range, c%, arr
- For Each rng In Range("bh3:bh" & Range("bh65536").End(3).Row)
- If rng >= min And rng <= max Then '判断bh列单元格数值是否在最大 最小值内
- c = c + 1 '计数
- arr = Range("c" & rng.Row).Resize(1, 6)
- rng.Offset(0, 2).Resize(1, 6) = arr '左侧单元格数据到右侧单元格
- Else '如果不在范围内
- rng.Offset(0, 2).Resize(1, 6) = "" '右侧单元格为空值
- End If
- Next
- [bj1] = "提取结果:" & c & "注"
- Dim i%
- For i = 3 To Range("bh65536").End(3).Row
- If Range("bh" & i) <> "" Then
- Range("bi" & i) = Application.WorksheetFunction.CountA(Range("bh3:bh" & i))
- End If
- Next
- End Sub
- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim rng As Range
- Set rng = Intersect(Target, [bh:bh])
- If rng Is Nothing Then
- Exit Sub
- Else
- '[bj1] = ""
- Call 提取
- End If
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|