|
- Sub Macro1()
- Dim i&, s&, m As Shape
- s = 2
- For Each m In ActiveSheet.Shapes
- If m.Type <> 8 Then m.Delete
- Next
- For i = 3 To Range("b65536").End(xlUp).Row + 1
- If Cells(i, 2) <> Cells(i - 1, 2) Then
- Set rng = Range(Cells(s, 1), Cells(i - 1, 1))
- l = rng.Left: t = rng.Top
- w = rng.Width: h = rng.Height
- ActiveSheet.Shapes.AddShape(msoShapeRectangle, l, t, w, h).Select
- Selection.ShapeRange.Line.Visible = msoFalse
- Selection.ShapeRange.Fill.UserPicture ThisWorkbook.Path & "" & Cells(i - 1, 2) & ".jpg"
- s = i
- End If
- Next
- [a1].Activate
- End Sub
复制代码 |
|