大佬教程收集整理的这篇文章主要介绍了VBA 代码不输入 else if 并结束 if 循环,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
我编写了下面的循环,但是我遇到了进入 else if 循环的代码的问题,并使循环直到(结束 if)范围彼此相等。本质上,我希望循环先将 2 添加到包含“Corporates”的单元格中,然后将 1 添加到数字为 2 的单元格中。@H_944_3@
Dim x As Long
Dim V As Variant
V = Cells(Rows.Count,1).End(xlUp).Row
JV = Range("J" & Rows.Count).End(xlUp).Row
For x = 1 To V
If Cells(x,2).Value = "Corporates" Then
Cells(x,7).Value = Cells(x,7).Value + 1
ElseIf Cells(x,12).Value < "3%" And Cells(x,7).Value + 1
End If
Range("J" & JV + 3).Value = Range("J" & JV + 2).Value
Next x
End Sub
使用嵌套的 If
而不是 ElseIf
@H_944_3@
我猜 < "3%"
应该是 < 0.03
("3%"
是文本,不是数字)。@H_944_3@
If Cells(x,2).Value = "Corporates" Then
If Cells(x,12).Value < 0.03 Then
Cells(x,7).Value = Cells(x,7).Value + 2
Else
Cells(x,7).Value + 1
End If
End If
以上是大佬教程为你收集整理的VBA 代码不输入 else if 并结束 if 循环全部内容,希望文章能够帮你解决VBA 代码不输入 else if 并结束 if 循环所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。