VBA Change event linking the values of a cell in a sheet with another cell in another sheet

nmounir

New Member
Joined
Oct 16, 2020
Messages
16
Office Version
  1. 365
Platform
  1. Windows
Hello Everyone,

I have been trying to write a VBA code where the value in D2 of a sheet called "formulator" is equal to the value of cell D2 in another sheet called Product DataBase

Purpose is to not have anyone change the value or formula in cell D2 in the formulator sheet even if that sheet name changes. I am using a change event.

here is the code i used but doesn;t work:

Private Sub Worksheet_Change(ByVal Target As Range)

If Target.Address = Range("D2").Address Then
Target.Value = "='Product DataBase'!D2"
End If

End Sub

Book1.xlsm
F
9
Formulator


Thank you everyone
 

Some videos you may like

Excel Facts

Back into an answer in Excel
Use Data, What-If Analysis, Goal Seek to find the correct input cell value to reach a desired result

Watch MrExcel Video

Forum statistics

Threads
1,128,017
Messages
5,628,153
Members
416,296
Latest member
smartua

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
Top