Tag: excel vba

Combine multiple columns data to single column [Excel VBA]

combine-multiple-columns-data-to-single-column-excel-vba

If you want to combine multiple columns data to a single column using excel VBA, then use below code. Below macro combines data of 10 columns and displays it in first column. Change numOfColumns variable value as per your requirement. Also see VBA macro to remove empty columns

Remove blank rows inside cell [excel VBA]

remove-blank-rows-inside-cell-excel-vba

We can create new line/row inside a cell by pressing ALT+ENTER in MS Excel. If you come across a situation where you want to remove blank rows/lines inside the cell, then you can’t remove them using trim method. Below code helps you to remove them automatically using VBA code.

In the above code Chr(10) […]

[Excel VBA code] Convert a string to Uppercase letters

excel-vba-convert-string-to-uppercase-output

Excel VBA code to convert a string to uppercase letters. It converts all lowercase letters to uppercase.

Output:

VBA code to capitalize each word of a string [Excel]

capitalize-each-word-string-VBA-excel

Below is the Excel VBA code to capitalize each word of a string.

Output:

VBA macro to remove special characters from a string in excel

excel-macro-output-remove-special-characters

Simple VBA macro code to remove special characters from a string in excel. You can remove either all special characters or choose which special characters to remove from the string. This macro retrieves each character from the string and checks whether it belongs to A-Z,a-z,0-9 or a space.If it belongs then it stores them into another […]

VBA code to read a character within a string

VBA_Macro_read_single_character_within_string

VBA code to read a character within a string. Case 1: Suppose the string is “ Excel VBA macro”, and you want to read a character before BA (i.e. V) within that string. VBA code:

When you run above macro, below message box is displayed.   Case 2: Suppose the string is too long and […]

VBA macro to replace string between two delimiters within a string

Excel VBA macro to replace string between two delimiters within a string or text line. This article also explains the usage of Replace function in excel VBA macro. VBA code:

VBA macro to extract string between two delimiters in a text file

extract-string-between-two-delimiters-example-file

Excel VBA macro to extract string between two delimiters in a text file. This macro extracts string between two delimiters within a string even it contains multiple delimiters. VBA code:

 Note: If you get any compilation error, highlighting any special character, then delete it and                     […]