Giter VIP home page Giter VIP logo

Comments (4)

pyscripter avatar pyscripter commented on June 13, 2024 1

Here it works well:
image

Are you using the latest version of XLRisk?
Are you using a recent version of Excel?

from xlrisk.

joktimo avatar joktimo commented on June 13, 2024 1

Hi,

I've been having this same issue, and I think I have solved it.

The problem is in Sub ProduceTornadoDiagram() and it only arises if the user has Excel localized to some other language than English. What makes this even more complicated is that, if ProduceTornadoDiagram is excuted in break mode step by step, the code works perfectly well (at least sometimes)...

These two lines seems to be the problem:
mOutSheet.Names.Add Name:="TornadoX", RefersTo:="=INDIRECT(" & Cell.Offset(5).Value & Cell.Offset(6).Address() & ")"
mOutSheet.Names.Add Name:="TornadoY", RefersTo:="=OFFSET(INDIRECT(" & Cell.Offset(5).Value & Cell.Offset(6).Address() & "),0," & Cell.Offset(5).Value & Cell.Offset(2).Address & ")"

For some reason Excel doesn't localize these formulas to the formula notation of the local language before writing them down as named ranges, which will result in error in the next line of the code ( mOutSheet.Range("TornadoY").Select )

This can be seen from the screenshot I took (TornadoX and TornadoY in Risk results 1 are incorrect, Risk results 2 is after the correction):
kuva

This can be fixed, for example, by writing the formulas to cells and then reading them back with .FormulaLocal

So for example by changing the previous bit of code like this:
Cell.Offset(7).Formula = "=INDIRECT(" & Cell.Offset(5).Value & Cell.Offset(6).Address() & ")"
Cell.Offset(8).Formula = "=OFFSET(INDIRECT(" & Cell.Offset(5).Value & Cell.Offset(6).Address() & "),0," & Cell.Offset(5).Value & Cell.Offset(2).Address & ")"

mOutSheet.Names.Add Name:="TornadoX", RefersTo:=Cell.Offset(7).FormulaLocal
mOutSheet.Names.Add Name:="TornadoY", RefersTo:=Cell.Offset(8).FormulaLocal

from xlrisk.

pyscripter avatar pyscripter commented on June 13, 2024 1

Thanks! I was not aware of the localization of function names. I have also found this:
https://stackoverflow.com/questions/13247771/excel-macro-inserting-internationally-valid-formula-during-run-time

from xlrisk.

Eberwijn avatar Eberwijn commented on June 13, 2024

Hello,

Im using the latest office 365 excel version, and the latest version from github.
I think its a local issue on my own IT environment, so sorry for the issue i raised.

I really appreciate the tool you have created!

Kind regards
Hans Eberwijn

from xlrisk.

Related Issues (14)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.