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: Copy, excel vba input box, excel vba inputbox, Input Box, input box vba, input range vba, Paste, vba input range
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: excel macro find row, excel macro find text, excel macro find text in cell, excel vba find, excel VBA find row, excel vba find row containing text, excel vba find text, excel vba macro, find excel vba, find in excel vba, find row position, find row vba, vba find row, vba macro find
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
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: excel auto format cells, excel cell colorindex, excel cell conditional formating, excel cell format vba, excel error value, excel special cells
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
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
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
Simple Microsoft Excel formula to find the last day of any given month.
‘
=DATE(YEAR(A1),MONTH(A1)+1,0)
‘
Tags: excel formula, excel vba end of month, last day of month
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: excel vba, excel vba find last column, excel vba last column, vba column, vba excel last column, vba get last column, vba last column, vba tutorial
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 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
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: excel vba macro, excel workbook