|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
由于楼主没有回复我的问题,只能猜测了。见代码:- Private Sub Worksheet_Change(ByVal Target As Range)
- Dim Rng As Range, StrHy$
- With Sheets("其它类-11")
- Application.EnableEvents = False
- If Target.Column = 1 Then
- Set Rng = .[a:a].Find(Target.Value, , , 1)
- If Not Rng Is Nothing Then Target(1, 5) = Rng(1, 2)
- ElseIf Target.Column = 2 Then
- Set Rng = .[d:d].Find(Target.Value, , , 1)
- If Not Rng Is Nothing Then Target(1, 5) = Rng(1, 2)
- ElseIf Target.Column = 7 Then
- StrHy = Target(1, -1) & Target(1, 0) & Target
- Cells(Target.Row, "L") = StrHy
- Set Rng = [m:m].Find(StrHy, Lookat:=2, SearchDirection:=2)
- If Not Rng Is Nothing Then
- Cells(Target.Row, "M") = StrHy & Format(Val(Right(Rng, 5)) + 1, "00000")
- Else
- Cells(Target.Row, "M") = StrHy & Format(1, "00000")
- End If
- End If
- Application.EnableEvents = True
- End With
- End Sub
复制代码 |
|