Filter VBA Offset function

p4nny

Board Regular
Joined
Jan 13, 2015
Messages
246
Hello

I currently have the code however I would like to change it slightly.

The line with '''''

Rather than the code perform this action "testCell.Offset(, 1).Value = "Key in the dependency ID"

I would like it to filter another tab called "dependencies" (column A) by using the value in the original tab (Offset(, -2)

Then stop the code on the "dependencies" tab.

So when testCell.Value = "Y" Then filter "dependencies" tab for the value in (Offset(, -2)

Hope that makes sense.




Code:
Private Sub Worksheet_Change(ByVal Target As Range)


Dim testRange As Range


Set testRange = Application.Intersect(Target, Range("C:C"))


If Not testRange Is Nothing Then
    Application.EnableEvents = False
    For Each testCell In testRange
        If testCell.Value = "Y" Then
            ''''''testCell.Offset(, 1).Value = "Key in the dependency ID"
        Else
            testCell.Offset(, 1).Value = "N/A"
        End If
    Next testCell
    Application.EnableEvents = True
End If


End Sub
 

Excel Facts

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,215,618
Messages
6,125,870
Members
449,266
Latest member
davinroach

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top