Question : Concatenate

Hi,
My Col A contains data series as below. Consider each line as a row. Problem is the company name is getting splitted somehow and coming in the next immediate line, I want to concatenate and have the full name.
eg. for line 1 it should be, CA - TMF GENERAL MOTORS, for the line 4 it should be                   CA APPLICATION SERVICES. Please help.

CA - TMF GENERAL
MOTORS
1900
CA APPLICATION
SERVICES
1062
CA CANADA
1747

Answer : Concatenate

Hi,

try this

Kris
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:
19:
20:
21:
22:
23:
24:
25:
26:
27:
Sub kTest()
Dim ka, k(), i As Long, c As Long, n As Long

With ActiveSheet.UsedRange
    ka = .Value
    ReDim k(1 To UBound(ka, 1), 1 To UBound(ka, 2))
    If IsArray(ka) Then
        For i = 1 To UBound(ka, 1)
            If Len(ka(i, 3)) = 0 Then
                If IsNumeric(ka(i, 1)) Then
                    k(n, 1) = ka(i, 1): GoTo Nxt
                End If
            End If
            If ((IsNumeric(ka(i, 3))) * (Right$(Cells(i, 3).NumberFormat, 1) = "%") * _
                (Not IsNumeric(ka(i, 1)))) Then
                k(n, 1) = Trim$(k(n, 1) & " " & ka(i, 1))
                n = n + 1: For c = 2 To UBound(ka, 2): k(n, c) = ka(i, c): Next
            Else
                n = n + 1: For c = 1 To UBound(ka, 2): k(n, c) = ka(i, c): Next
            End If
Nxt:
        Next
    End If
    .ClearContents
    .Cells(1).Resize(n, UBound(ka, 2)).Value = k
End With
End Sub
Random Solutions  
 
programming4us programming4us