我想在生成前八名的代码中加入转换文本,可是运行不了,显示 Text 未定义,请高手指点修改,谢!!
Private Sub 前八名()
Dim i, j As Integer
j = 2
For i = 5 To Sheet1.Range("c65536").End(3).Row ' 从第5行循环到最后的数据行
If Sheet1.Cells(i, 13) = "决赛" And Sheet1.Cells(i, 10) <> "" Then
If Sheet1.Cells(i, 9) = 1 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat '数字格式化,按原格式输出。
If Cells(j, 5) = "400米" Or Cells(j, 5) = "800米" Or Cells(j, 5) = "1500米" Or Cells(j, 5) = "3000米" Or Cells(j, 5) = "5000米" Or Cells(j, 5) = "3000米竞" Or Cells(j, 5) = "5000米竞" Or Cells(j, 5) = "4×100米" Or Cells(j, 5) = "4×400米" Then
Cells(i, 8).Select
Cells(j, 6) = Text(Sheet1.Cells(i, 8), "mm:ss.00")
Else: Cells(j, 6) = Sheet1.Cells(i, 8)
End If
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "一"
j = j + 1
ElseIf Sheet1.Cells(i, 9) = 2 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat
Cells(j, 6) = Sheet1.Cells(i, 8)
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "二"
j = j + 1
ElseIf Sheet1.Cells(i, 9) = 3 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat
Cells(j, 6) = Sheet1.Cells(i, 8)
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "三"
j = j + 1
ElseIf Sheet1.Cells(i, 9) = 4 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat
Cells(j, 6) = Sheet1.Cells(i, 8)
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "四"
j = j + 1
ElseIf Sheet1.Cells(i, 9) = 5 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat
Cells(j, 6) = Sheet1.Cells(i, 8)
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "五"
j = j + 1
ElseIf Sheet1.Cells(i, 9) = 6 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat
Cells(j, 6) = Sheet1.Cells(i, 8)
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "六"
j = j + 1
ElseIf Sheet1.Cells(i, 9) = 7 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat
Cells(j, 6) = Sheet1.Cells(i, 8)
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "七"
j = j + 1
ElseIf Sheet1.Cells(i, 9) = 8 Then
Cells(j, 1) = Sheet1.Cells(i, 3)
Cells(j, 2) = Sheet1.Cells(i, 4)
Cells(j, 3) = Sheet1.Cells(i, 5)
Cells(j, 4) = Sheet1.Cells(i, 6)
Cells(j, 5) = Sheet1.Cells(i, 7)
Cells(j, 6).NumberFormat = Sheet1.Cells(i, 8).NumberFormat
Cells(j, 6) = Sheet1.Cells(i, 8)
Cells(j, 7) = Sheet1.Cells(i, 9)
Cells(j, 8) = Sheet1.Cells(i, 13)
Cells(j, 9) = "八"
j = j + 1
End If
End If
Next i
'退出程序
End Sub