|
如下 :::
Sub 保存()
Sheets("Sheet1").Select
With Sheets("Sheet2")
x = .Range("a65536").End(xlUp).Row + 1
For i = 0 To 2
Sheets("Sheet2").Cells(x, 1) = [b2] '故障单号
Sheets("Sheet2").Cells(x, 2) = [d3] '车组号
Sheets("Sheet2").Cells(x, 3) = [b3] '车号
Sheets("Sheet2").Cells(x, 4) = [d2] '系统分类
Sheets("Sheet2").Cells(x, 5) = [b6] '故障描述
Sheets("Sheet2").Cells(x, 6) = [d5] '处理结果
Sheets("Sheet2").Cells(x, 7) = [b9] '处理时间
Sheets("Sheet2").Cells(x, 8) = [b4] '发现时间
Sheets("Sheet2").Cells(x, 9) = [d4] '发现人
Sheets("Sheet2").Cells(x, 10) = [b7] '处理方法
Sheets("Sheet2").Cells(x, 11) = [b8] '处理人
Next
End With
Range("b7,b8,b9,d8,d9").ClearContents
MsgBox "保存完毕", , "提示"
End Sub
你的代码有点问题,不需要循环的
另外我写了个,你试试
故障保存.rar
(10.13 KB, 下载次数: 9)
|
|