Nit*_*wls -1 excel vba excel-vba
我有一个宏来检查列J中单元格的值.基于我需要设置K和L列中的单元格的值,我想使用以下代码:
For Each Cell In TelRange
With Cell
If Left(.Value, 3) = 201 Then
Cell.Offset(0, 1).Value = "Mobile" And Cell.Offset(0, 2).Value = Left(Value, 5)
End If
End With
Next Cell
Run Code Online (Sandbox Code Playgroud)
然而,这不起作用.
有人知道怎么做吗?
从问题来看,它听起来像是1个动作而不是2个,对吗?尝试将其拆分为两行(AND用于逻辑操作,如A和B)
For Each Cell In TelRange
With Cell
If Left(Value, 3) = 201 Then
Cell.Offset(0, 1).Value = "Mobile"
Cell.Offset(0, 2).Value = Left(Value, 5)
End If
End With
Next Cell
Run Code Online (Sandbox Code Playgroud)
如果它不起作用,请说明发生了什么.错误信息?不更新?