|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Private Sub Worksheet_Change(ByVal Target As Range)
- If Target.Address <> "$B$1" Then Exit Sub
- Dim Rng As Range, str1, w, y
- On Error Resume Next
- Application.DisplayAlerts = False
- Dim shp As Shape
- For Each shp In ActiveSheet.Shapes
- If shp.Left > Range("L1").Left Then shp.Delete
- Next
- Set Rng = Range("M3").MergeArea
- str1 = ThisWorkbook.Path & "\图片文件" & Range("h1") & ".jpg"
- ActiveSheet.Pictures.Insert(str1).Select
- With Selection
- .ShapeRange.LockAspectRatio = msoFalse
- .Left = Rng.Left + 2
- .Top = Rng.Top + 2
- .Width = Rng.Offset(0, 1).Left - Rng.Left - 2
- w = Rng.Offset(1, 0).Top
- y = Rng.Top
- .Height = w - y - 2
- End With
- Application.DisplayAlerts = True
- End Sub
复制代码 |
|