Posts

Showing posts from 2019

Things I wished I know when I Started programming VBA

1.        Use auto complete word: Control + Space This invokes intellisense A further press of the Tab key will select the highlighted word If the Spacebar key instead of the Tab key is pressed it will add a space after selecting the highlighted word. 2.        View the definition: Shift + F2  and back to View the last position: Control + Shift + F2 2.1          If we have the following code in our module: Sub Calc()                   Dim result as Long                 Result = PerformCalc(5, 10)                 MsgBox “Result is “ & result                 End...

Most feasible way to work with Worksheet names in VBA code

1.        When you look in your VBA project screen it will represent a worksheet name   “Sheet1” (which is the default name when you open a workbook) as follows in the VBA project explorer: Microsoft Excel Objects Sheet1(Sheet1)                 ß The name in brackets is the name as you see it in the workbook and is the worksheet name.                                                 ß The name on the left is the code name. The worksheet name can be changed in the workbook or in the code module by selecting the sheet object and then changing the Name property in the properties window. The code name can only be changed in the properties window under the (Name) property. 2.        To refer to the worksheet name in code w...

Shortcut keys for VBA coding

1. Display the immediate window: Control + G. This window is giving the result of debug.print commands 2. Auto Complete Word: Control + Space This invokes intellisense A further press of the Tab key will select the highlighted word If the Spacebar key instead of the Tab key is pressed it will add a space after selecting the highlighted word. 3. View the Watch Window: Alt + V + H 4. Tab: To move lines of code to the right (Indent). 5. Shift + Tab: To move lines of code to the left (Out dent). 6. Shift + F2: Get the definition of the item under the cursor. 7. Ctrl + Shift + F2: Go to the last cursor position. 8. Alt + F11: Switch between Excel and the VBA Editor. 9. Ctrl + R: View the Project Explorer Window. 10. Ctrl + Shift + 8 (or Ctrl + *): Get the current region on a worksheet. 11. F4: View the Properties Window. 12. F5: Run the code from the current sub. 13. F8: Step into the code. 14. F9 (or click left margin): Add a breakpoint to pause the code. ...

Basic practices for easy readable VBA code

1        Use option explicit This will force you to declare variables. Option explicit can be typed in at the top of your module before any code or it can be automatically placed there by selecting the following items from the menu: à Tools Options and then select “require variable declaration”    2        Declare the variables as you use them If you declare the variables at the top of the code it becomes very messy 3        Indent your code and use blank lines Shift + Tab align all the code up Tab can then be used to indent the code line by line where appropriate                between loops and other programming statements. 4        Give variables nice names Use long descriptive names. You don’t have to use e.g. ‘lng’ in front if it is a long variable. Control + Space will help to complet...

VAT Calculations @ 15%

VAT - 15% VAT amount back to VAT inclusive amount =  VAT amount x R7.6666                                                                            VAT amount  /   0.130434782 VAT inclusive to VAT exclusive = Vat inclusive / 1.15

VBA Developer - Digitally sign your macro project

Image
Digitally sign your macro project This article describes how you can digitally sign a macro project by using a certificate. If you don't already have a digital certificate, you must obtain one. To test macro projects on your own computer, you can create your own self-signing certificate by using the Selfcert.exe tool. Obtain a digital certificate for signing You can obtain a digital certificate from a commercial certificate authority (CA) or from your internal security administrator or information technology (IT) professional. To learn more about certificate authorities that offer services for Microsoft products, see the list of  Microsoft root certificate program members . Your macro projects and Microsoft Office Because a digital certificate that you create isn't issued by a formal trusted certificate authority, macro projects that are signed by using such a certificate are known as  self-signed projects . Microsoft Office trusts a self-s...

Best Programming Languages for the Future

The most important skill to learn in today's world is to know how to write a computer program. The programming and developer community are emerging at a rate faster than ever before. Various new programming languages are coming up that are suited for different categories of developers (beginners, intermediate and experts) as well as for different use cases (web application, mobile applications, game development, distributed system etc). If you organized programming languages into tiers based on their popularity, they would fall into three tiers.  The top tier, second-tier,  and third-tier. Most of the languages in the top tier are firmly entrenched. It takes a while for a programming language to fall out of the top tier, and it's very hard for a second-tier language to break into the top tier. The emerging languages are in a third tier, and they are just starting to gain a following. Some languages have been in the third tier for many years, never taking that next step ...