作者:乔山办公网日期:
返回目录:excel表格制作
经测百试度,下问面的答代码可回用答
Dim i As Long
i = 3
Do
If Cells(i, 5).Value <> Cells(i - 1, 5).Value And Cells(i, 5).Value <> 0 Then
Rows(i).Insert shift:=xlDown
i = i + 1
End If
If Cells(i, 5) = 0 And i > Sheet1.UsedRange.Rows.Count Then Exit Do
i = i + 1
Loop
if range("C10") < 0 and range("B36") =2 then
range("C4") = 2
end if
比如在抄A列中输入数值,当小于零时,袭提示出错。
Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Column > 1 Then
Exit Sub
Else
If Target < 0 Then
Target = Null
MsgBox "输入知数值小于0,请道注意!"
End If
End If
End Sub
你的结果是对的呀知,没有给出代码,也不知道你的代码哪里有错道,如果是还没有写代码,版关键部分如下权,可供参考:
for i = 3 to 7
if cells(i,2)>5 then cells(i,7)="不合理" else cells(i,7)="合理"
next i