|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
- Sub yy()
- Dim Sht As Worksheet, i&, aa$, Myc%, j%, bb, r1
- aa = "产品名称,产品规格,物料编号,物料名称,规格型号,计量单位,实发数量"
- Application.ScreenUpdating = False
- For Each Sht In Sheets
- Sht.Activate
- Myc = [iv3].End(xlToLeft).Column
- For i = Myc To 1 Step -1
- If InStr(aa, Cells(3, i)) = 0 Then
- Cells(1, i).EntireColumn.Delete
- End If
- Next
- bb = Array("规格型号", "实发数量")
- For j = 0 To 1
- Set r1 = Rows(3).Find(bb(j))
- If r1 Is Nothing Then
- If j = 0 Then
- Columns("E:E").Insert Shift:=xlToRight
- Range("E3").Select
- [e3] = bb(0)
- Selection.Font.ColorIndex = 3
- Else
- Range("g3").Select
- [g3] = bb(1)
- Selection.Font.ColorIndex = 3
- End If
- End If
- Next
- Next
- Application.ScreenUpdating = True
- End Sub
复制代码 |
|