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 "YES" signal.

And this "YES" signal will keep changing and the name will also keep changing whenever condition match.

it will copy C2 name and paste it to "paste.xlsm" C3 cell

 

and it will autosave "paste.xlsm" after pasting the data.

 

 

 

 

Thanks

 

  • 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

17 Replies

Resources