Ask Your Question
0

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

asked 2019-03-17 05:45:06 +0100

GaryDown gravatar image

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

C:\fakepath\cost comparison.ods C:\fakepath\1.PNG C:\fakepath\2.PNG

Any help will be appreciated, Gary,

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
0

answered 2019-03-17 07:24:30 +0100

GaryDown gravatar image

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"

edit flag offensive delete link more
Login/Signup to Answer

Question Tools

1 follower

Stats

Asked: 2019-03-17 05:45:06 +0100

Seen: 12 times

Last updated: Mar 17