请高手忙吧讲解下···谢谢!!
With ActiveSheet
If Target.Count > 2 Then Exit Sub
Set rng = .Range("E28")
If Union(rng, Target).Address = rng.Address Then
Static chkrange As Range
If Not chkrange Is Nothing Then
chkrange.Comment.Delete
End If
Dim cmt As Comment
Dim hasComment As Comment
Dim jpgImg As Object
Set chkrange = Target
Set hasComment = Target.Comment
If hasComment Is Nothing Then
Set cmt = Target.AddComment
Else
Set cmt = Target.Comment
End If
cmt.Visible = True
pcode = .[b28].Text
If VBA.Asc(pcode) >= 65 And VBA.Asc(pcode) <= 122 Then
ac = VBA.Left(pcode, 7)
If InStr(1, ac, "-") > 0 Then
fname = "V:\P Code\Customer\" & .[E38].Text & "\" & pcode & ".jpg"
Else
fname = "V:\P Code\Others\AC Code\" & pcode & ".jpg"
End If
Else
str = VBA.Left(pcode, 6)
If CInt(str) <= 1000 Then
fname = sPath & "000001-001000\" & pcode & ".jpg"
ElseIf CInt(str) > 1000 And CInt(str) <= 2000 Then
fname = sPath & "001001-002000\" & pcode & ".jpg"
ElseIf CInt(str) > 2000 And CInt(str) <= 3000 Then
fname = sPath & "002001-003000\" & pcode & ".jpg"
ElseIf CInt(str) > 3000 And CInt(str) <= 4000 Then