mercredi 31 mars 2021

Need to update a value in a cell based on another cell value from the list in excel vba

I have Excel macro-enabled sheet - Chart.xlsm- where the values are selected from the lists:

enter image description here

My goal is - when selecting Column D (Type of Workday) = "Day Off" then I want the columns E (Day Outcome) and F (Reason) will be automatically updated with "Not Applicable" value.

My values for (Type of Workday), (Day Outcome) and (Reason) columns selections are stored in this same macro spreadsheet file, but in a separate sheets if that's important

I am not a vba savvy so I tried to use the following code (with no success):

    Private Sub Worksheet_Change(ByVal Target As Range)
       Dim sh As Worksheet
       Set sh = ActiveSheet
    If sh.Cells(3, 4) = “Day Off” Then
       Sh.Cells(3,5) = “Not Applicable”
    End If
   End Sub

Aucun commentaire:

Enregistrer un commentaire