Hi all,
I have the following code which formats the cell values in column A to 10 characters on entry:
For example:
Enter excel in A1 and it changes to '00000EXCEL
Enter 123456 in A2 and it changes to '0000123456
Enter abc456 in A3 and it changes to '0000ABC456
I want to format it as text so that it does not have the apostrophe ('). Any help?
Thank you,
Gos-C
I have the following code which formats the cell values in column A to 10 characters on entry:
Code:
Sub FormatToTenCharacters()
Dim Cell As Range, LR As Long
LR = Range("A" & Rows.Count).End(xlUp).Row
For Each Cell In Range("A1:A" & LR)
If Len(Cell.Value) < 10 Then Cell.Value = "'" & Application.Rept("0", 10 - Len(Cell.Value)) & UCase(Cell.Value)
Next Cell
End Sub
For example:
Enter excel in A1 and it changes to '00000EXCEL
Enter 123456 in A2 and it changes to '0000123456
Enter abc456 in A3 and it changes to '0000ABC456
I want to format it as text so that it does not have the apostrophe ('). Any help?
Thank you,
Gos-C