Create New Excel Worksheet With VBA

Posted on the September 13th, 2008 under Workbook and Worksheet by Poer @ Excel VBA/Macro

The Excel VBA macro below will create a new Excel Worksheet called ‘RawData’ or we can use msgbox to ask for the Worksheet name if needed.

If there is already a Worksheet called RawData, user will be ask whether they want to use the old Worksheet and cancel new Worksheet creation, or delete the old Worksheet and continue creating a [...] Continue Reading…

How To Open Excel File Using Macro

Posted on the September 11th, 2008 under Excel VBA Function by Poer @ Excel VBA/Macro

Imagine this condition; We are in the middle of doing something using Excel VBA macro, then we want the macro to automatically show the File Open dialog box to make us (user) able to choose another Excel file to be opened by Excel.

Got the picture? Below is vba procedure that do exactly like that, show the File Open dialog [...] Continue Reading…

Changing Microsoft Excel Status Bar

Posted on the September 10th, 2008 under Excel VBA Function by Poer @ Excel VBA/Macro

Maybe for some reason we want to change our Microsoft Excel Status Bar, then this simple vba function will do the work for us.

The end result will look like this:

Ok, to do it, put this following code in ThisWorkbook code

Private Sub Workbook_Open()
‘when workbook opened, change the status bar
Application.StatusBar = “Changing Excel [...] Continue Reading…

Handy VBA To Calculate Person Age

Posted on the September 10th, 2008 under Excel VBA Function by Poer @ Excel VBA/Macro

This handy VBA procedure is just to show you how we can calculate and display someone Age. To do this, of course we need to know their date of birth first, then simply using datediff and mod vba functions we can calculate how old is he/she.

Sub PersonAge()
Dim iYears As Integer, iMonths As Integer, iMonth As [...] Continue Reading…

Getting Cell Reference With Input Box

Posted on the September 9th, 2008 under Excel VBA Function by Poer @ Excel VBA/Macro

We can get an input from user using Input Box, but we also can use the Input Box to get the address of cell reference in Microsoft Excel.

Using simple Excel VBA procedure below we can ask user to select range of cells (as copy input) and where they want it paste.

Sub CopyPaste()

Dim InputCells As Excel.Range
Dim OutputCells As Excel.Range

On Error [...] Continue Reading…

How To Find the Last Row That Contain Data in Excel?

Posted on the June 17th, 2008 under Excel VBA Function by Poer @ Excel VBA/Macro

UPDATE June 13, 2008:

Another alternative way to find the last row with data :

Function LastRow() As Long

Dim ix As Long
ix = ActiveSheet.UsedRange.Row – 1 + ActiveSheet.UsedRange.Rows.Count
LastRow = ix

End Function

I did a simple test, and the function will return the correct last row position [...] Continue Reading…

How to ceiling a decimal number in Excel?

Posted on the June 16th, 2008 under Excel VBA Function by Poer @ Excel VBA/Macro

Ceiling, or changing a specific decimal number into become its upper number, for example if we ceiling 3.25 we will got 4, or if we ceiling 2.75 then we will got 3 as a result.

To get a result like that in Microsoft Excel, we can simply use this very simple but neat Excel VBA function

Function Ceiling(Number As Double) As [...] Continue Reading…