Excel在单元格里插入多张图片。点击按钮,自动往单元格插入多张选中的图片
菜单栏选择“开发工具”-“插入”-“按钮”,指定相关的宏代码。
作者:Excel小子-Office中国
Excel插入多个图片操作动画
Excel插入多个图片详细VBA代码:
Sub SelectFile()
'选择单一文件
Dim s, p, c
Dim rg As Range
With Application.FileDialog(msoFileDialogFilePicker)
.AllowMultiSelect = False '单选择
.Filters.Clear '清除文件过滤器
.AllowMultiSelect = True
.Filters.Add "All Files", "*.*" '设置两个文件过滤器
If .Show = -1 Then 'FileDialog 对象的 Show 方法显示对话框,并且返回 -1(如果您按 OK)和 0(如果您按 Cancel)。
For Each p In .SelectedItems
Set rg = ActiveCell.Offset(c, 0)
ActiveSheet.Shapes.AddShape(msoShapeRectangle, rg.Left, rg.Top, rg.Width, rg.Height).Select
Selection.ShapeRange.Line.Visible = msoFalse
With Selection.ShapeRange.Fill
.Visible = msoTrue
.UserPicture p
.TextureTile = msoFalse
.RotateWithObject = msoTrue
End With
c = c + 1
Next p
End If
End With
End Sub
如喜欢此技巧,手机右上角点开,分享到QQ空间,方便自己以后看