Dim K, L, M, N
' K = InputBox()
L = InputBox()
M = InputBox()
N = InputBox()'好像只要三个 就够用了{:301_1008:}
Range("B4:B98").FormulaR1C1 = "=IF(AND(RC[-62]>=cells(1,n),RC[-62]<cells(1,m),"""",(""A"" & i ))"
把 =IF(AND(A4>=1,A4<22),"",A4) =IF(AND(A4>=M,A4<N),"",A4) or =IF(AND(AK>=M,A4<N),"",A4) or=IF(Ak=m,"",IF(AND(A&k>m<n),"",A&k)) 写入 Range("B4:B&L")
问题出在这个公式里的双引号=IF(AND(A4>=1,A4<22),"",A4),其实你把这个公式直接放单元格里, 显示的是0,所以你直接用0去替换就好了,可以改成这样试试
For i = 4 To 98
Cells(i, 2).Formula = "=IF(AND(A" & i & ">=1,A" & i & "<22),0,A" & i & ")"
Next