|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
下面代码为啥不能按条件自动选路径呢?
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
Application.ScreenUpdating = False
If Target.Column <> 11 And Target.Row < 11 Then Exit Sub
Dim fpth
Dim str1
Dim Myr&, j
On Error Resume Next
Dim pic As Shape
For Each pic In ActiveSheet.Shapes
If InStr(1, pic.Name, "Drop Down") = 0 And pic.Name <> "标头01" And pic.Name <> "返回图" And pic.Name <> "项题01" And pic.Name <> "双横01" And pic.Name <> "圆角矩 01" Then pic.Delete
Next
Myr = Sheet2.[d65536].End(xlUp).Row
For j = 11 To Myr
If Range("D" & j) = "进项" Then
fpth = ThisWorkbook.Path & "\进项发票扫描图片夹\"
Else
fpth = ThisWorkbook.Path & "\销项发票扫描图片\"
End If
Next j
str1 = fpth & Target.Value & ".jpg"
With ActiveSheet
If Dir(str1) <> "" Then
.Pictures.Insert(str1).Select
With Selection
If Target.Column = 8 And Target.Row > 11 Then
Else
.Top = Target.Offset(1, -10).Top
.Left = Target.Offset(0, -11).Left
End If
End With
End If
End With
If Target.Column = 1 And Target.Row > 10 Then '调取录入窗体[D2:D65536]
单位列表.Show
End If
Application.ScreenUpdating = True
End Sub
恳请老师指点!
|
|