I need to calculate the error function, Erf(), in my VBA Excel program. I have implemented something like that:
aux_A = -Application.WorksheetFunction.Erf(p)
Previously, in Excel 2007, I install Analysis Toolpak Add-in and it works perfectly but, in Excel 2003 it doesn’t work (and the add-in is installed too).
What’s the problem?
(Please, note that I want to use the result in the VBA code, not in the Excel sheet).
Thank you!
Before Excel 2007, Erf was in the Analysis Toolpack so you had to call the functions directly (Without the WorksheetFunction part)
aux_A = -Erf(p)
Begining with Excel 2007, they move many functions into the WorksheetFunction library and that is why you now have to use WorksheetFunction.Erf(p).
In the VBA Editor, press F2 and search for Erf. You will see that the library and Class is different in versions prior and post 2007.
Doesn't the Erf function take 2 parameters (upper limit, lower limit)?
Add "Analysis Toolpack - VBA" in Add-Ins (Tools -> Add-Ins)
Add reference to atpvbaen.xla in VBA project editor (Tools -> References)
Try:
n = Erf(0.5)
Works for me.
Related
I had a VB script function Sub Workbook_Open() that was copying a value from one cell (a total from previous day) to another cell at file opening. Now I would like to put my Excel sheet online (MS Excel Online) where execution of VB scripts is not supported so I am trying to realise the same functionality with a formula like =FUNCTION().
Is it possible and how to evaluate a formula only once each time at file opening in MS Excel Online (without using VB script)?
While you cannot use VBA in Excel Online, you may be able to use Office Scripts.
This new scripting technology is currently in preview and it also needs to be enabled by your tenant administrator.
https://learn.microsoft.com/en-us/office/dev/scripts/overview/excel
If you don't yet have access to Office Scripts, I'm afraid there is no solution for what you describe.
Unfortunately the Online MS Office Scripting is not yet a reality as you can see on this link. Hopefully Microsoft have mercy on us one day and allow us to have this crucial feature for some of our most important workbooks. In the meantime, we shall be using this feature only offline.
I have an add-in that helps fill Excel tables with data from Atlassian Jira, used by several kinds of Excel files. The add-in has been created with the Excel VBA editor, not VSTO.
Now I need to use the functions of this add-in from macros in a Word template.
To avoid duplicating the code base, I would like to use this add-in in Word.
Trying to add a reference to the Excel add-in in Word triggers the error "Can't add a reference to the specified file".
Is there a reasonably simple way to achieve this?
If you want the best next thing you can do is inserting Excel table into Word document and then adding to that document your VBA code.
To add the Excel tabel just use Insert -> Table -> Excel Spreadsheet -> your toolbar will change to excel toolbar with the option for adding your VBA code like in Excel.
I have a vba program in excel in my computer (which is using 64bit). My friend can't have all the functions to work (hers is 32bit). What code can I add to make it compatible with the 32bit?
I want to share this excel sheet with many coworkers, so I need it to be compatible with 32bit.
I notice the error happens when calling the function in the worksheet_SelectionChange. I have a code that uses the Days() function.
m = Application.WorksheetFunction.Days(Date, myRange)
Thanks.
I have a very old VB6 application, we have lost the source code. It can call excel 2003, 2007 to
Launch excel
Insert value to the new sheet cells.
I guess it use com to automate the excel, anyway we lost the source code and cannot contact the programmer.
After we upgrade the office to 2010, it cannot insert value anymore, just a blank sheet ....why?
Do anyone have the same experience as me? old win32 program work on excel 2003/2007 , but don't work on 2010.
Attach screenshot for your reference:
when using excel 2007 , it can fill the value to sheet.
when using excel 2010 , it cannot, and the windbg show some exceptions, how can I troubleshoot it?
Even if you could trace/capture, I don't think that would help you much.
Based on the simplicity of the code, you would be better off remaking it from scratch. If it's something proprietary and very useful, you should probably consider having both versions installed at the same time, which has worked for me just fine.
I, in fact two end users have seen a strange issue in Excel.
When they CTRL+X to cut some cells and CTRL+V to paste, it does copy/paste, not cut/paste
They said it is related to the new version addin I built. I do not use or change anything about copy/cut/paste in my code at all. I suspect it is some options in Excel, but not sure what it is.
Do anyone know how to fix the cut/paste issue in Excel?
Edit
my addin is written in C#, Excel DNA, NetOffice, Add-In express. It is a xll addin with ribbonX and also has UDFs. There is no VBA except during install/uninstall, I use VBA to install xll and xla.
xla returns descriptions for UDF and register help topics.
thanks
This is related to skype, not my code or anything. Once skype is unistalled, copy/cut/paste works fine. see http://answers.microsoft.com/en-us/office/forum/office_2003-excel/excel-2003-moving-border-when-copying-not-working/f55b0eab-13ff-489c-bd2d-d16937cd02ec?msgId=19e8fa3b-0ac2-4af0-bde7-5ac52d131f10