|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
本帖最后由 小年玩卡 于 2023-7-2 15:01 编辑
求助大神,实在想不透是啥原因
为什么这段代码突然就没用了呢?用好几年了,突然就出现隐藏就不能获取,只有展开才能获取,这是什么问题?
Private Sub Workbook_SheetChange(ByVal Sh As Object, ByVal Target As Range)
If Sh.Index > 1 And Sh.Index < 35 Then
If Target.Count > 5 Or Target.Row < 8 Or Target.Row > 669 Then GoTo 100
Dim m&, myr, d, i&, rng
myr = Array(7, 58, 109, 160, 211, 262, 313, 364, 415, 466, 517, 568, 619)
Set d = CreateObject("Scripting.Dictionary")
For i = 0 To UBound(myr)
d(myr(i)) = ""
Next
m = Target.Row
If Target.Column = 7 Then
If Not d.Exists(m) Then
If Target.Column = 7 Then
If Target = "" Then Cells(m, "l") = "": Cells(m, "m") = "": Cells(m, "v") = "": Cells(m, "w") = "": GoTo 100
With Sheets("首页")
Set rng = .Columns(3).Find(Target.Value, lookat:=xlWhole)
If Not rng Is Nothing Then
Cells(m, "v") = rng.Offset(0, 1)
Cells(m, "w") = rng.Offset(0, 2)
End If
End With
End If
End If
End If
100:
End If
End Sub
如下图首页,是从这里获取数据,平常使用时点加号隐藏起来的,突然就变成不展开不能获取
这是其他工作表操作,G列输入首页C列对应的数据时,V列自动填入对应的数据
模板123.7z
(18.1 KB, 下载次数: 3)
|
|