刚帮boss写的一个excel宏
2008 11 19 03:17 PM 2292次查看
分类:编程 标签:无
其实700多行记录,手动转换也不用多久,学习和编写却花了1个小时…
Sub test()
Dim Row1 As Integer
Row1 = 1
For row2 = 1 To 741
If Left(Sheet2.Cells(row2, 1), 6) = "Serial" Then
Cells(Row1, 1) = Mid(Sheet2.Cells(row2, 1), 11, 7)
Cells(Row1, 2) = RTrim(Mid(Sheet2.Cells(row2, 1), 28, 40))
Cells(Row1, 2) = Left(Cells(Row1, 2), Len(Cells(Row1, 2)) - 1)
ElseIf IsEmpty(Sheet2.Cells(row2, 1)) And IsNumeric(Sheet2.Cells(row2, 7)) Then
Cells(Row1, 3) = Sheet2.Cells(row2, 7)
Cells(Row1, 4) = Sheet2.Cells(row2, 14)
Cells(Row1, 5) = Cells(Row1, 4) / Cells(Row1, 3)
Row1 = Row1 + 1
row2 = row2 + 2
End If
Next row2
End Sub
向下滚动可载入更多评论,或者点这里禁止自动加载。