各位老师,本人对VBA不是很懂,使用了一个代码
现在表格所需要插入图片的其中一列能实现双击插入图片后自动缩放到表格大小
但是同一sheet内另外一列要双击插入图片自动缩放则没办法做到,求大师帮忙改改
谢谢了
代码如下:
Private Sub Worksheet_SelectionChange(ByValTarget As Range) If Target.Count > 4 Then Exit Sub '如果选择一个区域时,退出程序 If Target.Column <> 4 Then Exit Sub '如果选择的不是A列,退出程序 Dim FolderSelect, shp As Shape Set FolderSelect =Application.FileDialog(msoFileDialogFilePicker) With FolderSelect If .Show = -1 Then ActiveSheet.Pictures.Insert .SelectedItems.Item(1) Set shp =ActiveSheet.Shapes(ActiveSheet.Shapes.Count) shp.LockAspectRatio = msoFalse shp.Left = Selection(1).Left shp.Top = Selection(1).Top shp.Width = Selection(1).Width shp.Height = Selection(1).Height End If End With End Sub
|