Consulting

Results 1 to 2 of 2

Thread: VBA: Append letter "JS"

  1. #1
    VBAX Regular
    Joined
    Apr 2007
    Posts
    9
    Location

    VBA: Append letter "JS"

    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.

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    [vba]

    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
    [/vba]

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •