Formula inserted by macro doesn't work

Hubs

New Member
Joined
Sep 10, 2021
Messages
5
Office Version
  1. 2019
Platform
  1. Windows
Hi everyone

I'm about to give up! I want to write, in a cell, the "greater or equal" or the "lesser or equal" signs, through a macro.
I've found the Excel formula =UNICAR(8804) for =< (and =UNICAR(8804) for >=). If i write it by hand, it's OK. but my vba is not OK.

ActiveCell.Offset(x,y).Formula R1C1 = "=UNICAR(8804)" results in a #NAME?

I've seen that UNICAR(xxx) neds the "xxx" to be text, and that the cell should be formatted in text, and that formulas should be written in english, so I ended up with the rather not straightforward formula :
ActiveCell.Offset(x,y).FormulaR1C1 = "=UNICAR(DROITE(TEXTE(8804;10);4))"
and
ActiveCell.Offset(x,y).FormulaR1C1 = "=UNICAR(RIGHT(TEXT(8804;10);4))"

Both bring a box with "execution error '1004': Error defined by the application or the object" (I'm translating from the French, but it should be something like that)
If I write the french version by hand in the cell, it's OK.


Question : What should be the proper formula in the macro ?

many thanks for your help

Hubert
 
Bingo ! I need to write ="UNICHAR(8804)"

Many thanks
You are welcome, glad we were able to help.

Yes, the Macro Recorder is a good tool for helping to debug the issues like this, because you can see exactly what Excel/VBA expect/want.
It is a good "trick" to keep in the toolbox! :)
 
Upvote 0

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"

Forum statistics

Threads
1,214,945
Messages
6,122,393
Members
449,081
Latest member
JAMES KECULAH

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