none
Connect a phrase at a cell in Excel when an other cell is filled with text RRS feed

  • Question

  • I've made a dropdown menu in cell B10.

    When filling cell A10 I would like to accomplice that text will appear in Cell B10 announcing that cell B10 must be filled in order to use cell A10.

    Is there any way to create this ? I think I have to use VBA but I don't know how :-(

    Tuesday, May 28, 2019 12:53 PM

All replies

  • 1) Copy this code.
    2) Right-Click the sheet tab of interest.
    3) Select "View Code"
    4) Paste the code into the window that appears.
    5) Save the file as a macro-enabled .xlsm file.
    6) Make changes as needed

    I have assumed that the value in cell B10 will be text....

    Private Sub Worksheet_Change(ByVal Target As Range)
        Dim strT As String
        If Target.Cells.Count > 1 Then Exit Sub
        If Target.Value = "" Then Exit Sub
        If Intersect(Target, Range("A10:A10")) Is Nothing Then Exit Sub 'expand the range if you need more cells specific range

        'Turn off events to keep out of loops
        Application.EnableEvents = False
        While strT = ""
        strT = Application.InputBox("You must enter a value for cell " & _
            Target.Offset(0, 1).Address(False, False) & ".  What should that value be?")
        Wend
        Target.Offset(0, 1).Value = strT

        'Turn events back on to get ready for the next change
        Application.EnableEvents = True
    End Sub

    Tuesday, May 28, 2019 6:23 PM