Posts

Showing posts from March, 2014

Using Named Ranges in Microsoft Excel

Image
Named Ranges in Excel enable you to give one, or a group of cells a name other than the default B4 for a single cell, or B2:E20 for a range of cells. So that you can refer to them in formulas using that name. You can view the complete tutorial here How to Use Named Ranges in Microsoft Excel  . When using Named Ranges there are also set of rules which you need to know like the scope where you can use the specified named range. If it's within only a single worksheet or the entire workbook. Check this out Named Range Rules  and be totally aware of the do's and don'ts when using this functions. Managing Your Named Ranges There'll come a time when you want to edit or delete a Named Range. To do this access the Name Manager on the Formulas tab of the ribbon. The Name Manager Dialog box will open. From here you can Edit and Delete your Named Ranges, or even create new ones. Remember, once you delete a name you cannot undo that action. Different uses fo...

How to Create a Configuration.INI Files in VB6

Image
In this example shows only a simple form that saves and retrieves value from the CONFIG.INI file. After reading this, you can use your own creativity on how you're going to implement this on your project. To start with, On your Form add the following controls and arrange them according to the image above. (1) TextBox - Change the Name property to "txtSetting" (2) Command Button - Change the Caption and Name Properties to the following:                                        Save:          Change the Name property to "cmdSave"                                        Retrieve:    Change the Name property to "cmdRetrieve" (5) Label - For the two labels we'll be using to retrieve the values. Remove the default caption and change...

Create Pagination Using jQuery-PHP-Ajax on a Webpage

Image
In this tutorial, I'll be showing you a basic example on how to create Pagination on your website. The purpose of this is just to give basic logic of how it was created. So, let's get it started. First, we will create the PHP file to print out the page ranges. We have two parameters $LIMIT and $RANGE that is passed by an Ajax request via jQuery. $LIMIT - This is the limit of rows per page to be displayed. $RANGE - Initially, this is set to 1. This is the pages range that will be displayed. It will decrement/increment as you click the Next or Previous buttons. Additional parameters... $MAX - The maximum number of pages to be shown in a range. This example shows 10. $RECORDS - Get the total number of records in the database table. $PAGES - This is the quotient of the $RECORDS divided by the $LIMIT . Then we do some conditional statement to print out the pages, next and prev button. PHP File (pages.php) <?php include "js/pagination.js...

Scrape Website Data into Excel using VBA

Image
I'll be showing you an example on how to Scrape Data from a Website into Excel Worksheet using VBA. We'll be scraping data from www(dot)renewableuk(dot)com. Please also read the privacy policy of the website before mining data. Goal: Get all data under all column headings which can be found on this website i.e. Wind Project, Region, ..., Type of Project Requirements: You need to add a reference, Microsoft HTML Object Library on your VBA project. Usage: You can call the ProcessWeb() sub directly by pressing F5 on the Microsoft Visual Basic Window. Or you can add a button on your excel worksheet then assign ProcessWeb() as the macro. VBA CODE: Function ScrapeWebPage(ByVal URL As String) Dim HTMLDoc As New HTMLDocument Dim tmpDoc As New HTMLDocument Dim i As Integer, row As Integer Dim WS As Worksheet Set WS = Sheets("DATA") 'create new XMLHTTP Object Set XMLHttpRequest = CreateObject("MSXML2.X...

How to use Do While Loop and a For Loop Counter in VB.Net

Image
In this tutorial, we'll be working on a real example on how to use Do...While Loop and a For...Loop Counter in VB.Net. Example Description: 1. A customer will be asked to enter the prices of 4 items purchased using an input box (create a counter loop). 2. A tax rate of 7% will be a constant. 3. Subtotal, tax rate, and total will be displayed in labels. 4. An accumulator inside the loop will be used to calculate the subtotal. 5. A pre-test post-test do while loop shall be used to control the limit of entering price. CODE: Public Class Form1 Private Sub btnEnterPrices_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnEnterPrices.Click Dim Price As String Dim SubTotal As Double, Tax As Double, Total As Double Dim limit As String, newLimit As String Dim i As Integer, n As Integer, response As Integer 'Prompts the user the input the number of prices to be calculated limit = InputBox(...

jQuery event.keyCode | event.charCode | event.which - Code Generator

Image
Key event handling is not that easy after all. However, it's more advisable to reliably get character codes during the keyPress event. There are two different types of codes: 1.)   event.keyCode: Keyboard Codes that Returns the Unicode value of a non-character key in a keypress event or any key in any other type of keyboard event. 2.) event.charCode: Character Codes that Returns the Unicode value of a character key pressed during a keypress event. In this tool I was using jQuery events to get the corresponding event codes of the keys the user pressed. CODE: $(document).ready(function(){ $('#key').live('keypress', processKeyPress); $('#key').live('keydown', processKeyDown); $('#key').live('keyup', processKeyUp); function processKeyDown(e) { processEvent('keyPress', e); } function processKeyPress(e) { processEvent('keyDown', e); } function pro...

Send Email with Excel VBA via CDO through GMail

Image
If you're working on a project or having a numerous reports in excel to be sent out to your boss or clients. And what you usually do is save the workbook, compose a new email, copy the contents or attach it on your email client. That's a time consuming task! What we wanted to do is automate the tasks from within the Excel Workbook you're working with. The SendEmail() Function below will do the task for you. Function Definition: Function SendEmail(ByVal Username As String, _                    ByVal Password As String, _                    ByVal ToAddress As String, _                    ByVal Subject As String, _                    ByVal HTMLMessage As String, _                    ByVal SMTPServer As String, _       ...

The Commonly Used Excel Functions

Image
Some Excel functions may apply to specific subject areas, while others are general and can be applied to all needs. The following shows a list of Excel Functions commonly used by everyone.

Download Music and MP3 Albums for Free Online Without Registration

Image
One of Google's Top Secret Tricks is the function to narrow down your search results to the most relevant items based on the keyword that you searched for. Now, I'll be showing you a simple guide on how to maximize your search capability. Let's just say you want to download free MP3 songs without having to navigate through various sites that may require you to login and create accounts just to download the file. 1. Fire up www.google.com on your browser and key in the search box "parent directory" mp3 lady gaga then Press Enter . 2. After you click open the link highlighted above you will see the contents of the directory of the artist's name. To download the file, simply Right Click on the file you want download and click "Save Link As" then click the save button. 3. To see more artists just click the "Parent Directory" as highlighted above and you will see the list of directories with the artist's name. Each...

Populate Data into ListView Control in VB.Net

Image
The following example Populates Data into ListView Control in VB.Net when the form is loaded. Add a ListView Control on your Visual Basic Project and add the following code snippet on Form Load event. Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load         With ListView1             .View = View.Details             .FullRowSelect = True             'Setup column headers             .Columns.Add("Product", 100)             .Columns.Add("Type", 100)             .Columns.Add("Price", 50)           ...

Populate Data into DataGridView Control using For-Loop in VB.Net

Image
The following example shows how to Populate Data to DataGridView Control in VB.Net. Public Class Form1 Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load With dgv 'SET COLUMN HEADERS .Columns.Add("Product Code", "Product Code") .Columns.Add("Product", "Product") .Columns.Add("Quantity", "Quantity") .Columns.Add("Price", "Price") 'START POPULATING DATA ROWS IN GRIDVIEW For i As Integer = 0 To 100 .Rows.Add() .RowHeadersVisible = False .Item(0, i).Value = "PC121113 " & i .Item(1, i).Value = "PRODUCT " & i .Item(2, i).Value = 100 - i .Item(3, i).Value = i Next .SelectionMode = DataGridViewSelectionMod...