Posts

Showing posts from November, 2012

17 ways to Optimize VBA Code for FASTER Macros

1. Analyze the Logic   2. Turn off ScreenUpdating 3. Turn off 'Automatic Calculations' 4. Disable Events 5. Hide Page breaks 6. Use 'WITH' statement 7. Use vbNullString instead of "" 8. Release memory of Object variables 9. Reduce the number of lines using colon(:) 10. Prefer constants 11. Avoid Unnecessary Copy and Paste 12. Clear the Clipboard after Paste 13. Avoid 'Macro Recorder' style code. 14. Use 'For Each' than 'Indexed For' 15. Use 'Early Binding' rather 'Late Binding' 16. Avoid using Variant 17. Use Worksheet Functions wherever applicable                 

50 Excel VBA Oral Interview Questions

Ques 01. What is the difference between ByVal and ByRef and which is default ? Solution: ByRef: If you pass an argument by reference when calling a procedure the procedure access to the actual variable in memory. As a result the variable's value can be changed by the procedure. ByVal: If you pass an argument by value when calling a procedure the variable's value can be changed with in the procedure only outside the actual value of the variable is retained. ByRef is default: Passing by reference is the default in VBA. If you do not explicitly specify to pass an argument by value VBA will pass it by reference. Ques 02. What is the meaning of Option Explicit and Option Base? Solution: Option Explicit makes the declaration of Variables Mandatory while Option Base used at module level to declare the default lower bound for array subscripts. For eg. Option Base 1 will make the array lower bound as 1 instead of 0. Option Base - When an array is declared by d