|
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件 ★ 免费下载 ★ ★ 使用帮助★
这个用VBA实现大致上是这样的:
————————————————————我是分界线————————————————————————————————
Option Explicit
Sub 查找原因并登记()
'找到不合格的原因,并把不合格的产品信息登记到不合格审理单中
Dim i, unnumber, w1 As Worksheet, w2 As Worksheet
'unnumber 是计数器,便于有顺序的粘贴不合格的产品
Set w1 = Worksheets("总检质量数据登记")
Set w2 = Worksheets("不合格审理单")
i = 4
unnumber = 1
Do While Len(w1.Cells(i, 6)) > 0
If Len(Trim(w1.Cells(i, 6))) > 2 Then
w2.Cells(unnumber + 2, 1) = w1.Cells(i, 1)
w2.Cells(unnumber + 2, 2) = w1.Cells(i, 2)
w2.Cells(unnumber + 2, 3) = w1.Cells(i, 3)
w2.Cells(unnumber + 2, 4) = w1.Cells(i, 4)
w2.Cells(unnumber + 2, 7) = w1.Cells(i, 6)
unnumber = unnumber + 1
End If
i = i + 1
Loop
End Sub
|
|