Hi, I want to to copy and paste to cell, near the cell with the text with formula, text not formula. Like in the photo, but automatically. Sorry for bad english. Can you suggest me something?
This code copies the value from cell A1 to cell B1 everytime the worksheet is calculated. which will be when the formula calculates a new value:
Put the code in the worksheet code
You haven't said which cells you wanted copying so I did A1 to B1
VBA Code:
Private Sub Worksheet_Calculate()
If Range("A1").Value <> Range("B1") Then
Range("B1") = Range("a1").Value
End If
End Sub
"Worksheet_Calculate" event procedure code (like offthelip posted) runs automatically as data is changed, as long as you have put it in the correct place.
It needs to be put in the sheet module of the sheet you want to apply it to.
One easy way to get there is to make sure you are on the sheet you want to have it run against, then right-click on the sheet tab name at the bottom of the screen, select "View Code", and copy and paste the code there.
Then as long as VBA is enabled, that code will run automatically (you won't need to do anything).
We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel
Which adblocker are you using?
Disable AdBlock
Follow these easy steps to disable AdBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the icon in the browser’s toolbar. 2)Click on the "Pause on this site" option.
Go back
Disable AdBlock Plus
Follow these easy steps to disable AdBlock Plus
1)Click on the icon in the browser’s toolbar. 2)Click on the toggle to disable it for "mrexcel.com".
Go back
Disable uBlock Origin
Follow these easy steps to disable uBlock Origin
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.
Go back
Disable uBlock
Follow these easy steps to disable uBlock
1)Click on the icon in the browser’s toolbar. 2)Click on the "Power" button. 3)Click on the "Refresh" button.