Forum Discussion
samnpti
Jul 19, 2021Brass Contributor
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...
- Jul 22, 2021
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
HansVogelaar
Jul 27, 2021MVP
You can simply change "C3" to "C15" in the code.
samnpti
Jul 27, 2021Brass Contributor
I did in that way.But its giving error.
Private Sub Worksheet_Calculate()
Static OldVal As Variant
If Range("C3:C15").Value <> OldVal Then
ThisWorkbook.Save
OldVal = Range("C3:C15").Value
End If
End Sub
Or can u make any changes in sheet 1 will save?