|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub InsertPic()
- Dim rng As Range, rw As Range, picpath As String
- Set rng = [D1:AD80]
- ActiveSheet.DrawingObjects.Delete
- For Each rw In rng
- If rw.MergeArea.Rows.Count = 7 And rw.MergeArea.Columns.Count = 7 And rw.Column = rw.MergeArea.Column And rw.Row = rw.MergeArea.Row Then
- picpath = ThisWorkbook.Path & "\图片附件" & rw.Offset(-2, 0) & rw.Offset(0, -2) & "15" & Mid(rw.Offset(-4, -2), 5, Len(rw.Offset(-4, -2)) - 6) & ".jpg"
- If Dir(picpath) <> "" Then
- With ActiveSheet.Pictures.Insert(picpath)
- .Top = rw.Top + (rw.MergeArea.Height - 62.25) / 2
- .Left = rw.Left + (rw.MergeArea.Width - 62.25) / 2
- .Height = 62.25
- End With
- End If
- End If
- Next rw
-
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|