Getting Cell Reference With Input Box

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 [...]

Tags: , , , , , , ,


How To Find Row Position of a Particular Text

Sometimes in Excel, we need to find the row position of a particular text, maybe to be able to paste certain of data right below the corresponding text or else.
Very useful if we have an Excel Worksheet Template that we use a lot, with fix header on it.
‘ Input param: Text we want to look [...]

Tags: , , , , , , , , , , , , ,


Convert Excel Column Number into Column Name

Update:
Sorter version of the VBA function:
Function Number2Char(c As Integer) As String
Number2Char = Split(Cells(1, c).Address, “$”)(1)
End Function
Courtesy of The Plaid Cow.
OR
Function Number2Char(ByVal vNumber)
Dim addr As String
If vNumber 256 Then Exit Function
addr = Range(“A1″).Offset(0, vNumber – 1).Address
Number2Char [...]

Tags: , , , , , , , , , , ,


Auto Format Excel Cells with Error Value

With the simple Excel macro below, we can make all cells in active Worksheet that contains Error value in it, like #NULL, #Div/0!, #VALUE!, #Ref, #NAME?, #NUM!, And #N/A, will automatically having cell format that different/stand out among all other cells.
In this example, background color of the cell that contains the error value will automatically [...]

Tags: , , , , ,


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

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 [...]

Tags: , , , , , , , , , , , , , , ,


Move Cursor To One Cell Below Last Row With Data

Ever want to paste some data into new empty cell after the last cell with data in certain column? Then take a look at this simple macro.
‘first, select cell in the first row of that column, like A1, K1, etc
Range(“A1″).Select
‘move to the last [...]

Tags: , , , , , , , , , , ,


VBA Delete Excel Rows Based on Certain Date

Let say I have a bunch of formatted data in my Excel sheet, and in Column A I have a dates. Then I wanna filter all the data base on certain date, for example 1 Jan 2009, and delete all others data before that date.
The algorithm is like this: I’ll create a loop from the [...]

Tags: , , , , , , ,


Find the Last Day of any Month

Simple Microsoft Excel formula to find the last day of any given month.

=DATE(YEAR(A1),MONTH(A1)+1,0)

Tags: , ,


Get Position of Last Column Containing Data with Excel VBA

If you read my latest update on how we can get position of last row containing data, then most probably you already have a glimpse on how we perform the same task with last column containing data in Excel.
The VBA code is the exact replica of the code to get the last row, only [...]

Tags: , , , , , , ,


How To Hide an Excel Worksheet

Some time we want to hide a certain Excel Worksheet from view, and it’s a common practice to use select the Worksheet, go to menu Format > Sheet > Hide.
Using the method explained above is right, but unfortunately, others people can easily unhide the Worksheet using the same method, only this time, instead of selecting [...]

Tags: , , , , , , , , , , , , , , , , , , , , , , , ,


Remove Non-AlphaNumeric Characters from String

The function below will allow us to remove a non alphanumeric character from an input string.
Be careful though, lengther the string, more time needed to evaluate each string on the sentence.
To bad that I don’t have any idea on how to use Regular Expression in Excel VBA, if we can use regex to replace [...]

Tags: ,


Check If Excel Workbook is Already Open or Not

In my case, I work a lot with transferring data from current Excel Workbook to another Excel Workbook, and to be able to do that, of course I need to make sure whether the destination Workbook is already open or not.
The following excel vba function assigned to check whether a workbook we need is open [...]

Tags: ,