简体   繁体   English

自动基于另一个单元格替换单元格值-VBA

[英]Automatically replace cell value based on another cell - VBA

So, i´m new at this... 所以,我是新来的...

I have this code: 我有以下代码:

    Private Sub Worksheet_Change()


    If Range("C2").Value = "T0" Then
        Range("C4").Value = "1"
    End If


End Sub

But excel keeps on giving me a "Run-time error 28 : Out of stack space" 但是excel不断给我一个“运行时错误28:堆栈空间不足”

Private Sub Worksheet_Change(ByVal Target As Range) If target.address="$C$2" and target.value = "T0" Then Range("C4").Value = "1" End If End Sub

检查目标地址为C2是可选的,我假设C2已更改,这就是您要捕获的内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM