How to keep a alpha value in a cell when changing in a macro

Version: 6.1.3.2 (x64) Build ID: 86daf60bf00efa86ad547e59e09d6bb77c699acb CPU threads: 12; OS: Windows 10.0; UI render: default; Locale: en-AU (en_AU);

[WARNING] - macros exist but do not reference outside themselves

Cell J9 and J11 is a select (Y/N)
When I select “n” in J9 I override the values in J10 to zero and wand J11 to become “N”. The J10 works fine but the J11 seems to lose format and become 0.

the macro code is

Function setSellPrice(inputValues, sellPriceAddress as string, CalcAsBuyer as string)
Dim sold as string
dim document as object

sold = inputValues(1, 1)

If Sold = “N” then
document = ThisComponent
sheet = document.Sheets(0)
sheet.getCellRangeByName(sellPriceAddress).Value = 0
sheet.getCellRangeByName(CalcAsBuyer).Value = “N”
End If

End Function

cost comparison.ods
1.PNG
2.PNG

Any help will be appreciated,
Gary,

It turned out to be quite simple (took a bit of finding but…)
replaced
sheet.getCellRangeByName(CalcAsBuyer).value = “N”
with
sheet.getCellRangeByName(CalcAsBuyer).String = “N”