Add common prefix to all cells in Excel

Type this in cell B1, and copy down…

="X"&A1

This would also work:

=CONCATENATE("X",A1)

And here’s one of many ways to do this in VBA (Disclaimer: I don’t code in VBA very often!):

Sub AddX()
    Dim i As Long

    With ActiveSheet
    For i = 1 To .Range("A65536").End(xlUp).Row Step 1
        .Cells(i, 2).Value = "X" & Trim(Str(.Cells(i, 1).Value))
    Next i
    End With
End Sub

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)