ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Re Worksheet Change Issue (https://www.excelbanter.com/excel-programming/323902-re-worksheet-change-issue.html)

DocuMike

Re Worksheet Change Issue
 
I have some code using Worksheet_Change so when the user changes a cell
value, it runs the CopyFilterData5 macro. I have another cell on the
worksheet that's driven from a VLOOKUP table...when the value of the cell
changes, I want to run the macro also. I tried putting the cell location in
(i.e. E26,A2 but it won't trigger it. It appears that the Worksheet_Change
only works if a cell is manually changed. Any ideas? Thanks

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("E26")) Is Nothing Then
Sheets("Entry").Select
Application.Run "CopyFilterData5"
End If
End Sub

gocush[_29_]

Re Worksheet Change Issue
 
Depending on what the user is allowed to change, you might be able to change
your formulas as follows:

Say E26=VLOOKUP(A1,MyTable,3,False)

Then in the event code:
If Not Intersect(Target,Range("A1")) Is Nothing then

or

If Not Intersect(Target,Range("MyTable").Columns(3)) Is Nothing then

If the user has full access this won't cover all possibilities.


"DocuMike" wrote:

I have some code using Worksheet_Change so when the user changes a cell
value, it runs the CopyFilterData5 macro. I have another cell on the
worksheet that's driven from a VLOOKUP table...when the value of the cell
changes, I want to run the macro also. I tried putting the cell location in
(i.e. E26,A2 but it won't trigger it. It appears that the Worksheet_Change
only works if a cell is manually changed. Any ideas? Thanks

Private Sub Worksheet_Change(ByVal Target As Range)
If Not Intersect(Target, Range("E26")) Is Nothing Then
Sheets("Entry").Select
Application.Run "CopyFilterData5"
End If
End Sub



All times are GMT +1. The time now is 10:56 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com