Search code examples
excelvbaautofill

Autofill Value in a cell based on other cell


Is there any way to get a specific value "66" in "B1" when I Put Text "Ok" in "A1" without entering Formula in "B1"


Solution

  • You can try Worksheet_Change event. Try below codes.

    Private Sub Worksheet_Change(ByVal Target As Range)
        If Not Application.Intersect(Target, Range("B1")) Is Nothing Then
            If Val(Target.Value) = 66 Then
                Range("A1") = "Ok"
            End If
        End If
    End Sub