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: alphanumeric, string
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 [...]
Tags: create new worksheet vba, create worksheet vba, excel macro create new sheet, excel vba create new sheet, excel vba create new worksheet, excel vba new sheet, excel vba new worksheet, vba add worksheet, vba create new sheet, vba create new worksheet, vba excel create new sheet, vba excel create new worksheet, vba excel new worksheet, vba new worksheet, Worksheet
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: excel 2007 last row, excel last row, excel last row with data, excel vba find last row, excel vba find last row with data, excel vba formula, Excel VBA Function, excel vba last row, excel vba last row with data, excel vba lastrow, find last row excel vba, last row excel vba, last row in Excel, last row with data, vba excel last row, VBA last row with data
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: columns, delete row, excel macro, excel macro delete row, excel vba delete row, filtered date, function cells, vba delete excel row
A few weeks ago I received this question from someone called LS:
Hi
I want to write a macro that counts the following
- Number of cells with formula
- Number of Rows with formula
- Number of Columns with formula
Please let me know if there is a way of doing it in Excel VBA
To find out the number of [...]
Tags: cells, columns, excel cells, excel formula, excel macro count rows, excel macro count the no of rows with text, excel vba count rows, rows, vba count rows, vba macro, worksheet cells
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: Excel, excel macro, excel vba, excel vba hide all worksheets, excel vba hide column, excel vba hide sheet, excel vba hide worksheet, excel vba hide worksheets, excel workbook, excel worksheet, Hide sheet vba, hide worksheet, hide worksheet vba, Microsoft, microsoft excel, VBA, vba excel hide sheet, vba hide sheet, vba hide worksheet, vba macro, VeryHidden, visual basic editor, Workbook, Worksheet, xlSheetVeryHidden
The purpose of the following example of Excel VBA macro is to get the acronym or an abbreviation of each of the first letter of any given words.
Function Acronym(Words As Variant) As String
Dim aWord() As String, ix As Integer
aWord = Split(Words.Value, ” “)
For [...]
Tags: acronym, array, excel macro example, excel vba example, left, split, ucase
Ok, this time I want to talk about how to create a vlookup table array that automatically expanding in accordance with the numbers of available data.
As we know, the basic form of Excel VLOOKUP to look for A1 value in range B1:C15 column no 2 is like this:
=VLOOKUP(A1,B1:C15,2)
With parameters such as the value we looking [...]
Tags: excel 2003 vlookup, excel formulas vlookup, excel vba vlookup, excel vlookup table array, lookup table, microsoft excel vlookup, vlookup array formula, vlookup excel vba, vlookup pivot tables, vlookup VBA macro
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: ActiveCell, excel macro move cursor, excel macro select cell below, excel vba, excel vba find last row, excel vba find last row with data, excel vba move cursor, last row with data, move cursor, Offset, vba macro, vba move cursor
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: column name excel, column number into column name, excel column name, excel macro column name, excel macro column number, excel vba column name, excel vba column number, excel vba columns, excel vba get column name, how to get column name in excel, VBA column name, vba excel column name
Do while … loop, do until … loop, do … loop while, do … loop until, and while … wend are the format of looping that we can use in Excel VBA.
The main reason why we need to perform looping is to simplified a repeating tasks. Rather then manually calling a block of code over [...]
Tags: do until vba, excel macro while loop, excel vba loop, excel vba loops, vba do loop, vba do while, vba tutorial, vba while, vba while loop
This is the reason why the power of Excel when combined with VBA is almost limitless. When we can’t found any Excel function that suite our need, we can built it easily using Excel VBA.
If Excel macro or SUB procedure is easily created using Record Macro button, and usually build to simplify a complex process [...]
Tags: Excel Formula