View Full Version : VBA: Append letter "JS"

04-12-2007, 03:11 AM
Hi guys,

I have a problem regarding this:
I would like to append JS if the set of characters starts with the number, ex. 8JS32 = the return result must be JS8S32.

And if it starts with the letters the program will not append JS.

04-12-2007, 03:21 AM
Public Sub ProcessData()
Const TEST_COLUMN As String = "A" '<=== change to suit
Dim i As Long
Dim iLastRow As Long
Dim cell As Range
Dim Sh As Worksheet

With ActiveSheet

iLastRow = .Cells(.Rows.Count, TEST_COLUMN).End(xlUp).Row
For i = 1 To iLastRow
If IsNumeric(Left(.Cells(i, TEST_COLUMN).Value, 1)) Then
.Cells(i, TEST_COLUMN).Value = "JS" & .Cells(i, TEST_COLUMN)
End If
Next i

End With

End Sub