Forum Discussion

samnpti's avatar
samnpti
Brass Contributor
Jul 19, 2021
Solved

copy data to different worksheet

HansVogelaar   Sir I have a two different excel file   1.copy.xls(Running in compatibility mode) 2.paste.xlsm   in copy.xls  sheet2 having "if" formula in D2. When condition match in D2 get "Y...
  • HansVogelaar's avatar
    HansVogelaar
    Jul 22, 2021

    samnpti 

    Right-click the sheet tab of Sheet1.

    Select 'View Code' from the context menu.

    Copy the following code into the worksheet module:

    Private Sub Worksheet_Calculate()
        Static OldVal As Variant
        If Range("C3").Value <> OldVal Then
            ThisWorkbook.Save
            OldVal = Range("C3").Value
        End If
    End Sub

Resources