Forum Discussion

Jlwiv87's avatar
Jlwiv87
Copper Contributor
Aug 06, 2021
Solved

Delete cell contents based on the condition of another cell

Hello, I am creating a inventory management system. The page in question is on my Stock Out page. This page has the following column headings: DATE, SALES ORDER, CODE, NAME, UNITS, VALUE PER UNIT, TO...
  • Subodh_Tiwari_sktneer's avatar
    Aug 07, 2021

    Jlwiv87 

    You need to adopt the VBA approach to achieve this.

    The attached file contains a Change_Event Code on Stock Out Sheet Module and as per the code, if you delete the Code in any row, the corresponding Unit will also be deleted.

     

    Private Sub Worksheet_Change(ByVal Target As Range)
    On Error GoTo Skip
    If Target.Column = 3 And Target.Row > 2 Then
        Application.EnableEvents = False
        If Target = "" Then
            Cells(Target.Row, "E") = ""
        End If
    End If
    Skip:
    Application.EnableEvents = True
    End Sub

     

     

     

Resources