How to add text to the beginning of all cells

,

This post explains that how to add the specified text or characters to the beginning of all cells in excel. How to create an excel formula to add same text string or characters to the beginning of text string in one Cell. How to create an excel macro to add specific text to the beginning of the text in all of cells.

Add text to the beginning of all cells with Formula

If you want to add the specific text or characters into the beginning of the text in one cell or all cells, you can create an excel formula based on the concatenate operator or CONCATENATE function.

Assuming that you want to add text “excel” into the beginning of the text in Cell B1, you can write down the following formula:

="excel"&" "& B2

OR

=CONCATENATE(“excel”,””,B1)

You can enter the above formulas in Cell C1, and then drag the fill handle down to other cells in column C and you will see that the specific text will add the beginning of the text in Cell B1.

add text to beginning of cell1

add text to beginning of cell1

Add text to the beginning of all cells with Excel VBA

You can create a new excel macro to add text string “excel” to the beginning of text in Cell B1 in Excel VBA, just refer to the below steps:

1# click on “Visual Basic” command under DEVELOPER Tab.

Get the position of the nth using excel vba1

2# then the “Visual Basic Editor” window will appear.

3# click “Insert” ->”Module” to create a new module

convert column number to letter3

4# paste the below VBA code into the code window. Then clicking “Save” button.

Sub addTextAtBeginningCell()
    Dim r As Range
    For Each r In Selection
        If r.Value <> "" Then r.Value = "excel " & r.Value
    Next
End Sub

add text to beginning of cell3

5# back to the current worksheet, then run the above excel macro, you will see that the specific text “excel” has been added into the beginning of the text in all selected Cells.

add text to beginning of cell4


Related Formulas

Related Functions

  • Excel Concat function
    The excel CONCAT function combines 2 or more strings or ranges together.This is a new function in Excel 2016 and it replaces the CONCATENATE function.The syntax of the CONCAT function is as below:=CONCAT (text1,[text2],…)…

Leave a Reply