Search code examples
excelvbainputbox

Write the result of an InputBox on a Cell if another Cell is = TRUE


I want the below code to write the result of an InputBox on the cell L14 if the cell C4 has the text "TRUE".

    Sub dele()

    myValue4 = InputBox("What's the number?")

    If Range("C4").Value = "TRUE" Then
    Range("L14").Value = myValue4

    End If

Doesn't seem to work. Any ideas?


Solution

  • Text conditions are case sensitive. Therefore try with this:

    If Ucase(Range("C4").Value) = "TRUE" Then
    

    However, if you have just a boolean value in Range("C4") this should also work:

    If Range("C4").Value = True Then