我正在尝试粘贴
=IF(AND(C4-C3<($I$1/1000),A4=A3),"OOOO","-----")
进入一个单元格,我通过
Range("I3").Select
ActiveCell.FormulaR1C1 = "=IF(AND(C4-C3<($I$1/1000),A4=A3)," & Chr(34) & "OOOO" & Chr(34) & "," & Chr(34) & "-----" & Chr(34) & ")"
Range("I3").Select
返回运行时错误“1004”应用程序定义或对象定义错误
我已经尝试过双引号并看到 & Chr(34) & 解决方法并尝试过。没有任何效果。此外,一些简单的事情
ActiveCell.FormulaR1C1 = "=IF("
不起作用,但是
ActiveCell.FormulaR1C1 = "=IF"
做。
奇怪的是,这在代码中有效
Range("C3").Select
ActiveCell.FormulaR1C1 = "=MID(B3,1,2)*3600+MID(B3,4,2)*60+MID(B3,7,9)"
Range("C3").Select
我之前做的。如果我将 "=MID(B3,1,2)*3600+MID(B3,4,2)*60+MID(B3,7,9)" (而不是我尝试使用的字符串)粘贴到调试时出现问题代码并点击继续,它将粘贴该行,因此在两个语句之间不会发生任何事情。只有一些选择和复制/粘贴之间会发生什么,但如果你想看的话,我还是会把它包括在这里
Range("C3").Select
ActiveCell.FormulaR1C1 = "=MID(B3,1,2)*3600+MID(B3,4,2)*60+MID(B3,7,9)"
Range("C3").Select
Selection.Copy
Range("D3").Select
Selection.End(xlDown).Select
ActiveSheet.Paste
Range("K3:Z4").Select
Application.CutCopyMode = False
Selection.Copy
Range("K1").Select
ActiveSheet.Paste
Columns("H:H").Select
Application.CutCopyMode = False
Selection.Cut
Columns("M:M").Select
ActiveSheet.Paste
Columns("I:I").Select
Selection.Cut
Columns("H:H").Select
ActiveSheet.Paste
Range("I3").Select
ActiveCell.FormulaR1C1 = "=IF(AND(C4-C3<($I$1/1000),A4=A3)," & Chr(34) & "OOOO" & Chr(34) & "," & Chr(34) & "-----" & Chr(34) & ")"
Range("I3").Select