I was recently working on an Excel spreadsheet with a VBA module that inserted formulas with the MROUND function.
range.formulaR1C1 = "=MROUND(RC[-1],.02)"
The MROUND function is quite handy, it takes the value of the calculation and rounds it to the nearest value specified in the second argument (as opposed to the ROUND() fucntion which jsut rounds to the nearest significant digit) It is found within the "Analysis Toolpak" Add-in.
A colleague ran the spreadsheet and the darned thing fell over. It turns out they also had the add-in "Analysis Tookpak - VBA" installed. When we turned it off, it ran fine so now the code turns it off automatically.
Sub Workbook_Open()
If AddIns("Analysis Toolpak - VBA").Installed = True Then
continue = msgBox("Turning off Analysis Tookpak - VBA",vbOkCancel)
If continue = 2 Then
Exit Sub
Else
AddIns("Analysis Toolpak - VBA").Installed = False
End If
End Sub
No comments:
Post a Comment