乔山办公网我们一直在努力
您的位置:乔山办公网 > excel表格制作 > <em>excel</em>宏 IF怎么用-excel 宏语法,excel语法

<em>excel</em>宏 IF怎么用-excel 宏语法,excel语法

作者:乔山办公网日期:

返回目录: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

相关阅读

关键词不能为空
极力推荐

ppt怎么做_excel表格制作_office365_word文档_365办公网