Forum Discussion
Nishkarsh31
Aug 23, 2022Brass Contributor
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...
- Aug 23, 2022
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 Suband placed the instruction to clear contents in a general code module
Sub ClearManualInput() Range("ManualEntries").ClearContents End SubI hope this at least represents a step in the right direction.
PeterBartholomew1
Aug 23, 2022Silver Contributor
The point may be that the evaluation of worksheet formulae does not trigger change events. It is user input and changes made by VBA that will do that. The worksheet changes that you can trap are those made to the tables on the 'Gallons' and 'Sample' sheets (formally converting them to Excel Tables might improve the workbook usability)
The other part of your query would involve SheetSelectionChange which is a method within the module ThisWorkbook.