+ Reply to Thread
Results 1 to 3 of 3

Trigger column value changes in worksheet WS2 based on value change in WS1 column

  1. #1
    Registered User
    Join Date
    12-11-2010
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    2

    Trigger column value changes in worksheet WS2 based on value change in WS1 column

    WS1
    A B C
    7
    3
    6
    3

    WS2
    D
    7
    7
    3
    3


    I am trying to write a macro which is triggered on change of any Column A in worksheet1 and change is reflected in values in column D of worksheet 2
    e;g A1 = 7 is changed to 8 in worksheet 1
    then D1 and D2 should become 8

    --------------------
    On same woksheet I am able to write it but with columns in two different worksheets I am not able to write.

    ---------------------------------------------------
    Private OldVal As Variant

    Private Sub Worksheet_SelectionChange(ByVal Target As Range)
    OldVal = Target.Value
    End Sub

    Private Sub Worksheet_Change(ByVal Target As Range)
    If Not Application.Intersect(Target, Range("A1:A100")) Is Nothing Then
    MsgBox OldVal
    MsgBox Target.Value
    Set changeRange = Range("D1:D65")
    For Each Cell In changeRange

    If Cell.Value = OldVal Then
    Cell.Value = Target.Value
    End If
    Next
    End If

    End Sub
    ---------------------------------------------------------------
    Any help is highly appreciated.

  2. #2
    Forum Expert
    Join Date
    11-29-2010
    Location
    Ukraine
    MS-Off Ver
    Excel 2019
    Posts
    4,168

    Re: Trigger column value changes in worksheet WS2 based on value change in WS1 column

    change your line in code to this one:

    Please Login or Register  to view this content.

  3. #3
    Registered User
    Join Date
    12-11-2010
    Location
    india
    MS-Off Ver
    Excel 2003
    Posts
    2

    Re: Trigger column value changes in worksheet WS2 based on value change in WS1 column

    Thanks a lot, it works..
    I tried earlier with Set changeRange = Worksheets("WS2").Range("D1:D65")
    But seemed to give an error. I am totally new to Macros. May be I did a mistake somewhere.
    Set changeRange = Worksheets("WS2").Range("D1:D65") is also working.
    Thanks again,
    Sunny.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1