locked
Wanted to replace some values in other sheets RRS feed

  • Question

  • Hi

    I have put text 'IP Address' in Sheet1:CellB2

    Now I wanted to replace text called 'ServerName' from all other sheet. So whenever I update Sheet1:CellB2 value it should automatically update all other sheets.

    I do not want to use replace dialog.

    Please suggest.


    Regards, Firoj Awate

    Tuesday, March 8, 2016 6:34 AM

Answers

  • Firoj

    I suggest using the worksheet change event.  In sheet 1 in the VBE, double click "Sheet1(------)", then select "Worksheet" from the dropdown above the code window. Then select "Change" from the second dropdown.  Assuming that you want the updated Server Name to go into the same cell on each sheet, the following code should work for sheet 2.  You can do a loop if it is the same cell on all other sheets, or name the cells individually if different cells are used.

    Private Sub Worksheet_Change(ByVal Target As Range)

        If Target = Range("B2") Then
            Worksheets(2).Range("B2").Value = Target.Value
        End If

    End Sub

    Hope this helps

    Andy C

    Tuesday, March 8, 2016 10:56 AM