|
- Sub Macro1()
- On Error Resume Next
- Dim rng As Range, mypath$$, i&, j&
- mypath = ThisWorkbook.Path & "\图库"
- Application.DisplayAlerts = False
- For Each sht In Sheets
- If sht.Name <> "查找" Then sht.Delete
- Next
- With Sheet1
- For i = 4 To 8 '列
- If Sheets(.Cells(1, i)) Is Nothing Then
- With Sheets.Add(after:=Sheets(Sheets.Count))
- .Name = Sheet1.Cells(1, i)
- End With
- End If
- For j = 2 To 5 '行
- Set rng = Cells(1, j).Resize(4, 1)
- ActiveSheet.Shapes.AddShape(msoShapeRectangle, rng.Left, rng.Top, rng.Width, rng.Height).Select
- Selection.ShapeRange.Line.Visible = msoFalse
- Selection.ShapeRange.Fill.UserPicture mypath & .Cells(1, i) & "" & .Cells(j, i) & ".JPG"
- Next
- Next
- End With
- Sheet1.Activate
- Application.DisplayAlerts = True
- End Sub
复制代码 |
评分
-
查看全部评分
|