Forum Discussion

Nishkarsh31's avatar
Nishkarsh31
Brass Contributor
Aug 23, 2022
Solved

Can VBA Event "Change" work if the target address cell is a formula that changes dynamically?

I have data coming in from different sheets using vstack and a target cell, which caluclates the total vstack rows using ROWS(A2#) On "Today" sheet, I have some manual entires, I want to clear th...
  • PeterBartholomew1's avatar
    PeterBartholomew1
    Aug 23, 2022

    Nishkarsh31 

    I wouldn't count myself as a VBA expert either!

    What I have tried is to move the event handler to the 'Gallons' Sheet:

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    
    If Not Intersect(Target, Worksheets("Gallons").ListObjects("Table1").Range) Is Nothing Then ClearManualInput
    
    End Sub

    and placed the instruction to clear contents in a general code module

    Sub ClearManualInput()
    
    Range("ManualEntries").ClearContents
    
    End Sub

    I hope this at least represents a step in the right direction.

     

Resources