Excel เพิ่มรูปด้วย VBA

เริ่มโดย mr.zatan, 22 กุมภาพันธ์ 2016, 08:50:37

หัวข้อก่อนหน้า - หัวข้อถัดไป

0 สมาชิก และ 1 ผู้มาเยือน กำลังดูหัวข้อนี้

mr.zatan

ดูให้หน่อยว่าผิดตรงไหน ใส่รูปได้ แต่เวลาลบ จะขึ้น Error

Private Sub Worksheet_Change(ByVal Target As Range)
If Intersect(Target, Columns("I")) Is Nothing Then Exit Sub
Dim myPict As Picture

With Cells(Target.Row, "B")
Set myPict = Cells(Target.Row, "B").Parent.Pictures.insert("D:\imagee\" & Target.Value & ".jpg")
    myPict.Top = .Top
    myPict.Width = .Width
    myPict.Height = .Height
    myPict.Left = .Left
    myPict.Placement = xlMoveAndSize
End With

End Sub