-
Here you are:
[VBA]Sub GenerateCodes()
Dim num As String
Dim txt
Dim str As String
Dim cnt As Long
Dim rngA As Range
Dim rngB As Range
Dim cel As Range
Set rngA = ActiveSheet.Range("A1").Resize(Range("A" & Cells.Count).End(xlUp).Row, 1)
Set rngB = ActiveSheet.Range("B1").Resize(Range("B" & Cells.Count).End(xlUp).Row, 1)
For Each cel In rngB
txt = Split(cel.Value, " ")
For cnt = LBound(txt) To UBound(txt)
str = str + Left(txt(cnt), 1)
Next cnt
ActiveSheet.Range("C" & cel.Row) = _
str & "-" & Right(ActiveSheet.Range("A" & cel.Row), 5)
str = ""
Next cel
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
-
Forum Rules