请参考!
Sub lqxs()
Dim Drr, i&, Myr&
Dim xb$, col%, nl
Sheet1.Activate
[o4:p500].ClearContents
Myr = Cells(Rows.Count, 6).End(xlUp).Row
Drr = Range("f4:p" & Myr)
For i = 1 To UBound(Drr)
xb = Drr(i, 1): nl = Drr(i, 5)
If xb = "男" Then col = 2 Else col = 3
If Drr(i, 7) <= Application.VLookup(nl, [CS], col) Then Cells(i + 3, 15) = "生长迟缓": GoTo 100
If xb = "男" Then col = 2 Else col = 4
If Drr(i, 9) <= Application.VLookup(nl, [CS], 2 + col) Then Cells(i + 3, 15) = "中重度消瘦": GoTo 100
If Drr(i, 9) <= Application.VLookup(nl, [CS], 3 + col) Then Cells(i + 3, 15) = "轻度消瘦": GoTo 100
If nl > 18 And Drr(i, 9) < 18.5 Then Cells(i + 3, 16) = "体重过轻": GoTo 100
If Drr(i, 9) >= Application.VLookup(nl, [CS], 6 + col) Then Cells(i + 3, 16) = "超重"
If Drr(i, 9) >= Application.VLookup(nl, [CS], 7 + col) Then Cells(i + 3, 16) = "肥胖"
100:
Next
End Sub
|