代码出现,(*^__^*) 嘻嘻……,虽然没有女朋友,
但程序解决了,小小庆贺一下
Sub 转换单元格()
'
' Macro1 Macro
'
'
Dim shtSheet As Worksheet
For Each shtSheet In Sheets
If shtSheet.Name = "O3" Then
For k = 2 To shtSheet.UsedRange.Rows.Count
For i = 2 To 33
If (shtSheet.Cells(k, i) = "nodata" Or shtSheet.Cells(2, i) = "") Then
shtSheet.Cells(k, i + 33) = "——"
ElseIf (CInt(shtSheet.Cells(k, i)) < 50) Then
shtSheet.Cells(k, i + 33) = "A1"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 50) And (CInt(shtSheet.Cells(k, i)) < 100) Then
shtSheet.Cells(k, i + 33) = "A2"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 100) And (CInt(shtSheet.Cells(k, i)) < 120) Then
shtSheet.Cells(k, i + 33) = "A3"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 120) And (CInt(shtSheet.Cells(k, i)) < 160) Then
shtSheet.Cells(k, i + 33) = "B1"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 160) And (CInt(shtSheet.Cells(k, i)) < 180) Then
shtSheet.Cells(k, i + 33) = "B2"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 180) And (CInt(shtSheet.Cells(k, i)) < 200) Then
shtSheet.Cells(k, i + 33) = "B3"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 200) And (CInt(shtSheet.Cells(k, i)) < 240) Then
shtSheet.Cells(k, i + 33) = "C1"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 240) And (CInt(shtSheet.Cells(k, i)) < 300) Then
shtSheet.Cells(k, i + 33) = "C2"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 300) And (CInt(shtSheet.Cells(k, i)) < 360) Then
shtSheet.Cells(k, i + 33) = "C3"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 360) And (CInt(shtSheet.Cells(k, i)) < 400) Then
shtSheet.Cells(k, i + 33) = "C4"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 400) And (CInt(shtSheet.Cells(k, i)) < 600) Then
shtSheet.Cells(k, i + 33) = "D1"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 600) And (CInt(shtSheet.Cells(k, i)) < 800) Then
shtSheet.Cells(k, i + 33) = "D2"
ElseIf (CInt(shtSheet.Cells(k, i)) >= 800) Then
shtSheet.Cells(k, i + 33) = "E"
End If
Next i
Next k
End If
Exit Sub
Next shtSheet
Set shtSheet = Sheets.Add(Before:=Sheets(1))
shtSheet.Name = "O3"