打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
EXCEL批量自动插入图片的宏,由列内单元格内容从图片文件夹中自动插入
Sub InsertPic()
Dim i As Long, sPath As String, sfileName As String
sPath = "D:\pic\"
Application.ScreenUpdating = False
On Error Resume Next
With ThisWorkbook.Sheets("Sheet1")
For i = 1 To 256
If .Cells(1, i) <> "" Then
sfileName = sPath & .Cells(1, i) & ".jpg"
Cells(2, i).Select
.Pictures.Insert (sfileName)
If Err <> 0 Then
MsgBox .Cells(1, i) & ".jpg" & "不存在"
Err = 0
End If
End If
Next i
End With
Application.ScreenUpdating = True
Range("A1").Select
End Sub
本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
我认识的EXCEL、宏、VBA
在Excel中如何使用VBA根据姓名自动插入照片
VBA实用小程序:使用VBA代码安装或卸载加载宏
Excel怎么批量插入对应产品图片?
自学资料(Excel VBA)[收集整理5]
用递归算法删除带有多级子目录的目录
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服