belodelokelo
New Member
- Joined
- Mar 30, 2023
- Messages
- 17
- Platform
- Windows
- MacOS
Dear All,
I have this function on cell B1:
Then what I want for the below code is auto-detect any change on column B and do something on column C. I used for simplicity the .Value = "Works!" function since it's important for me now to have the explained functionality.
Briefly if I type on A then it filters B based on the table and does something else on C. So with one enter to do both.
I have this function on cell B1:
Basically, if on A1 I write something it checks a database on "RAW" sheet and returns the relevant value to B1.=FILTER('RAW'C:C,'RAW'T:T=A1)
Then what I want for the below code is auto-detect any change on column B and do something on column C. I used for simplicity the .Value = "Works!" function since it's important for me now to have the explained functionality.
Briefly if I type on A then it filters B based on the table and does something else on C. So with one enter to do both.
Private Sub Worksheet_Change(ByVal Target As Range)
Dim WorkRng As Range
Dim Rng As Range
Dim xOffsetColumn As Integer
Dim Xrg As Range
Set Xrg = Range("B:B")
Set WorkRng = Intersect(Application.ActiveSheet.Range("B:B"), Target)
xOffsetColumn = 2
If Not WorkRng Is Nothing Then
Application.EnableEvents = False
For Each Rng In WorkRng
If Not Intersect(Xrg, Range("B:B")) Is Nothing Then
Rng.Offset(0, xOffsetColumn).Value = "Works!"
Else
Rng.Offset(0, xOffsetColumn).Value = "No"
End If
Next
Application.EnableEvents = True
End If
End Sub