Copying text with added "=" (for formulas)

Bono330

New Member
Joined
Apr 3, 2011
Messages
10
Hello everyone.
I have a (1) workbook with formulas and I need to paste them to another (2) workbook with macro.
In (1) workbook I have them without “=” sign as they only work when pasted to specific place in (2) workbook. But I cannot make it work with copying.

So for example I have:

VLOOKUP(F2,'[myMakro.xls]Key to 1200'!$A$2:$B$24,2,0)

in (1) workbook with address: Workbooks("myMakro.xls").Worksheets(“Key to 1200”).Range("I1")

Now I try to copy it to (2) workbook to H1 cell using makro with code like:

myFormula = Workbooks("myMakro.xls").Worksheets(“Key to 1200”).Range("I1")
myNewFormula = "=" & myFormula
Range("h1").Value = myNewFormula

Problem is apparently with the “=” sign. I tried to work on that in several ways but nothing works :-(
I would be very grateful for any help.
 
I've seen this before, but can't remember what causes it, or the easy fix.

Seems like a long winded work around, but I'm wondering if using an abnormal character in place of "=", for example "|" then adding 'replace all' to the end of the procedure to substite "|" with "=".

Any thoughts AlphaFrog?
 
Upvote 0

Excel Facts

Copy PDF to Excel
Select data in PDF. Paste to Microsoft Word. Copy from Word and paste to Excel.
@jasonb75

I've never heard of an issue like you described. I still think it has to do with something about the text in I1 and not the equal sign. Double quotes surrounding or within the I1 text could mess up the formula.
 
Upvote 0
@jasonb75

I've never heard of an issue like you described. I still think it has to do with something about the text in I1 and not the equal sign. Double quotes surrounding or within the I1 text could mess up the formula.

Thank you for your time. Finally I was able to do it firstly putting "=" in destination cell and then: cell.formula = cell.formula & [formula.cell].

Unfortunately I encountered a different problem, as it is taken as text not a formula but I will ask for that in another threat if I will not solve it myself.
 
Upvote 0

Forum statistics

Threads
1,224,600
Messages
6,179,836
Members
452,947
Latest member
Gerry_F

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