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…
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…
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…
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…
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…
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…
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…