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
60,127
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

When did Power Query debut in Excel?
Although it was an add-in in Excel 2010 & Excel 2013, Power Query became a part of Excel in 2016, in Data, Get & Transform Data.

Forum statistics

Threads
1,148,154
Messages
5,745,097
Members
423,922
Latest member
Taconumber

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