HomeEXCEL VBA (XL97-2003)  |  EXCEL VB.Net  |  ACCESS VBA  |  EXCEL Spreadsheet Functions  | Material Management  | About me  |  Guestbook

        Having fun with Excel VBA

       In this section I want to show you some interesting and fun staff of the Excel VBA examples, so that if you are a beginner who is just starting to learn to swim in the sea of Visual Basic applications, you will soon realize the power of Visual Basic Programming. Hopefully after you have gone through all my earlier pages of learning VBA knowledge for Excel application, you would be able to start automating some of your routine and repetitive office work processes, or integrating Excel with Access applications in areas where you would hope to successfully eliminate some really very time-consuming and energy-sapping manual work routines. Good luck !

    Some of these examples are for demonstration purpose only. Some are contributed by internet community volunteers, and some are my own creations. The codes are strictly NOT for any commercial use but would be allowed only for personal experimentation or for use in your personal works.

    If you like to read more and enhance your VBA skill, the following are some of the popular online forums and websites.

http://www.dbforums.com/
http://www.pcreview.co.uk/
http://forums.devx.com/
http://www.tek-tips.com/
http://www.cpearson.com
http://j-walk.com/ss/
MSDN Library Archive

 
Copy data to new worksheets by selecting your choice using a combo box.
Copy the rows data from a master sheet with only the unique names under the Field "Region" and paste to individual new worksheets added. It then saves as individual workbooks to folder C:\Temp\
Copy all the data from multiple sheets except the row 1 heading, loop through one sheet at a time, and paste append to the master sheet.
Create new worksheets for all the data in the multiple sheets, base on list of unique values in column A; Another option to save the new worksheets with data already copied, to your default file path in "My Documents", with date format in today's date, hour, minutes, AM or PM.
Create new worksheets with the given template, base on the list of unique values in column A.
Delete all blank rows and columns in the CurrentRegion.
Delete all blank sheets from current Workbook.
Delete all other sheets except for one or more sheets that you specified to keep.
Delete only the specified rows and columns of the worksheet.
Delete all the project VBA Modules, including the event macro in ThisWorkBook before you save a copy.
Add Comment by double-clicking on any cell in the worksheet.
Disable/Enable Cut, Copy, Paste and PasteSpecial with VB macro.
Disable/Enable sorting of data n the worksheet
Disable/Enable sheets deletion with VB macro.
Disable/Enable new sheets insert with VB macro.
Disable/Enable rows and columns insert or delete with VB macro.
Disable users from renaming worksheets with VB macro.
Find headings in row one that has a Sales*Type string and delete all rows in that column that either do not have cell values of "Sales" and "Warranty" or the cells are blank; otherwise keep only rows that meet these criteria.
Jump to any sheet in the workbook by letting you quickly select from a drop-down list of sheet names.
ListBox to select and copy the selected rows to another worksheet.
Prevent users save as a different worksheet name, except only save as its default worksheet name
Prevent users from using SaveAs (as a different worksheet name, in the same or in a different location), except only save in its same default worksheet name in the same directory.
Segregate the text from the numeric values in the textual-numeric strings.
SpinButton to navigate through each Page Field of the Pivot Table, showing data for each selected criteria.
Using Union method in a worksheet level event procedure to keep users out of a restricted range.
When the execution of code ended, this worksheet will be permanently deleted. The code should be used together some trial period procedure after a certain expiry date (for example, like using: If Application.WorksheetFunction.Date > "1/1/2006" Then... or when users failed to correctly login with a password after an allowed number of trials, then permanently delete the workbook after the user closes it.


This site was created in Feb.2007
by William Tan