|
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用 · 内置多项VBA编程加强工具 ★ 免费下载 ★ ★ 使用手册★
- Sub 新建隐蔽工程工作表()
- Dim i%, r%, y%
- Application.DisplayAlerts = False
- Dim sh As Worksheet
- For Each sh In Worksheets
- If sh.Name <> "数据表" And sh.Name <> "sheet1" Then sh.Delete
- Next sh
- Application.DisplayAlerts = True
- For i = 2 To Sheets(1).Cells(Rows.Count, 1).End(xlUp).Row
- Sheets(2).Cells(4, 3) = Sheets(1).Cells(i, 1) '点位编号
- Sheets(2).Cells(4, 8) = Sheets(1).Cells(i, 2) '点位位置
- Sheets(2).Cells(5, 3) = Sheets(1).Cells(i, 3) '区域
- Sheets(2).Cells(5, 8) = Sheets(1).Cells(i, 4) '施工日期
- Sheets(2).Cells(2, 10) = Sheets(1).Cells(i, 5) '文档编号
- Sheets(2).Copy After:=Sheets(Sheets.Count)
- ActiveSheet.Name = Sheets(1).Cells(i, 1) '用点位编号来命名工作表
- '========================================================================
- Dim Name$, Path, RG
- For Each RG In Union(Range("a18"), Range("g18"), Range("a22"), Range("g22"))
- Name = ActiveSheet.Name & "" & Right(RG, 1) & ".jpg"
- Path = ThisWorkbook.Path & "" & Name
- If Dir(Path) <> "" Then
- With RG.MergeArea
- ML = .Left
- MT = .Top
- MW = .Width
- MH = .Height
- ActiveSheet.Shapes.AddShape(msoShapeRectangle, ML, MT, MW, MH).Select
- Selection.ShapeRange.Fill.UserPicture Path
- End With
- End If
- Next
- Next
- End Sub
复制代码 |
评分
-
1
查看全部评分
-
|