Terje Isaksen Developer blog

2011-06-21 (Tuesday)

Excel tips and tricks

Filed under: Developing — Terje Isaksen @ 14:40

New function in Excel 2007:

=IFERROR(expression; safevalue)

If something is wrong, giving #ERROR och #VALUE – the safevalue is used. Combination of IF() and ISERROR()

To prevent user from saving workbook:

Private Sub Workbook_BeforeSave (ByVal SaveAsUI As Boolean, Cancel As Boolean) 
    '  Following line will prevent all saving
    Cancel = True
    '  Following line will prevent the Save As Dialog box from showing
    If SaveAsUI then SaveAsUI = False
End Sub

Source: http://www.ozgrid.com/forum/showthread.php?t=26224&p=133079#post133079

To be able to save this anyway, go to Developer tab and click on Design Mode – then macros will not run, and you are able to save.


Blog at WordPress.com.