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
 

Joe4

MrExcel MVP, Junior Admin
Joined
Aug 1, 2002
Messages
66,124
Office Version
  1. 365
Platform
  1. Windows
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! :)
 

Excel Facts

Pivot Table Drill Down
Double-click any number in a pivot table to create a new report showing all detail rows that make up that number

Forum statistics

Threads
1,181,605
Messages
5,930,852
Members
436,764
Latest member
avalladarez

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
Top