Visual Basic (VB) is an elective part for developing spreadsheet in Excel. Program contains integral VB compiler to extend functionality of software. Programmers utilize VB to make extra interactive Excel programs. VB improved spreadsheet frequently resembles complete free software package unrelated to standard rows and columns format of spreadsheet. Finished program facet buttons, graphs and customized menus to control how user interacts with algorithms.
Opening the VB Compiler
1. In Excel, run VB programming window by go to Tools menu. Select "Macro" and choose "Visual Basic Editor".
This presents extra menus. Select "Insert" and choose "Module" option. A programming panel now shows, ready for fresh VB code.
Every macro in Excel is VB programs, whether they were particularly programmed in VB or made by Excel macro-recording tools. When you edit VB code in Excel, you are manipulating a macro.
Basic Operation
2. VB programs are subroutines and should be recognized in code. Start and end all VB programs with appropriate identifiers for subroutine. If you select to name routine "Statement," then first line in code would be Sub Statement (). Final line would be "End Sub." Real program content is in between these lines. All program lines have function and parameters. Easy function to show text to Excel screen is "MsgBox" command. Between subroutine calls, type MsgBox "This is my statement!"
Your new VB macro is three lines and print sentence as pop-up window. Check VB program by choosing "Run" menu. Click first choice, "Run Sub." Alternately, run VB module at any time by pushing F5 key.
Quick Learning
3. VB is difficult language and programmers take years to learn its complete abilities. As student of VB could take classes, there is direct and helpful method for fast recognizing program structure of VB to finish common Excel tasks.
Excel gives tool to make macros without programming VB code. This permits nonprogrammers to build programs. Though all macros edited in VB. By recording a macro by this method, beginner can study VB code to see easy tasks made in language.
In main window go to "Tools" then "Macro" and "Record New Macro". In pop-up window, type name for subroutine and push "OK." Now go to finish basic task in Excel. E.g. type data into cell, and format cell's color. When you are completed, push "Stop" on floating macro toolbar that shown when recording started.
Go sponsor to VB window. Click "Modules", and then connect module shown. VB window display subroutine name exposed before.



Reply With Quote
Copyright Techfuels
Bookmarks