Copy and paste to another cell data as text value automatically.

kozlikmak

New Member
Joined
Jul 11, 2022
Messages
5
Office Version
  1. 2016
Platform
  1. Windows
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?
 

Attachments

  • image_2022-07-11_192923710.png
    image_2022-07-11_192923710.png
    2.6 KB · Views: 20

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
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
 
Upvote 0
Can macro work all the time, while file is opened? It means when i make changes in my sheet it changes text value that macro is copying.
 
Upvote 0
Can macro work all the time, while file is opened? It means when i make changes in my sheet it changes text value that macro is copying.
"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).
 
Upvote 0

Forum statistics

Threads
1,223,952
Messages
6,175,595
Members
452,657
Latest member
giadungthienduyen

We've detected that you are using an adblocker.

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.
Go back
Back
Top