CONCATENATE

vmjan02

Well-known Member
Joined
Aug 15, 2012
Messages
1,134
Office Version
  1. 365
  2. 2021
  3. 2019
  4. 2016
  5. 2013
I have the code and is all perfect on if the data is in col e and f, bus as per the table the data will start for E and end to AA, so ned to modify the code to get the right output

Book2
BCDEFGHIJ
1Actual Bundle EtherOutPut
2BE10Gi101/0/0/4 ; Gi102/0/0/4 Gi101/0/0/4 Local Configured 0x8000 Gi102/0/0/4 Local Active 0x8000
3BE40Gi101/0/0/13 Gi101/0/0/13 Local Active 0x8000
4BE50Te0/2/0/3 ; Te0/3/0/3 Te0/2/0/3 Local Active 0x8000 Te0/3/0/3 Local Active 0x8000
5BE101Te0/3/0/9 Te0/3/0/9 Local Active 0x8000
6BE110Gi100/0/0/25 ; Gi101/0/0/25 Gi100/0/0/25 Local Active 0x8000 Gi101/0/0/25 Local Active 0x8000
7BE120Gi100/0/0/24 ; Gi101/0/0/24 Gi100/0/0/24 Local Active 0x8000 Gi101/0/0/24 Local Active 0x8000
8BE130Gi100/0/0/27 Gi100/0/0/27 Local Active 0x8000
9BE1000Te0/2/0/18 ; Te0/2/0/19 ; Te0/3/0/18 ; Te0/3/0/19 Te0/2/0/18 Local Active 0x8000 Te0/2/0/19 Local Active 0x8000 Te0/3/0/18 Local Active 0x8000 Te0/3/0/19 Local Active 0x8000
10BE10Te0/0/0/6 ; Te0/1/0/6 Te0/0/0/6 Local Active 0x8000 Te0/1/0/6 Local Active 0x8000
11BE20Te0/0/0/5 ; Te0/1/0/5 Te0/0/0/5 Local Active 0x8000 Te0/1/0/5 Local Standby 0x8000
12BE40Te0/0/0/12 ; Te0/0/1/4 ; Te0/1/0/12 ; Te0/1/1/4 Te0/0/0/12 Local Active 0x8000 Te0/0/1/4 Local Active 0x8000 Te0/1/0/12 Local Active 0x8000 Te0/1/1/4 Local Active 0x8000
13BE500Te0/0/0/11 ; Te0/1/0/11 ; Te0/2/0/3 ; Te0/2/0/11 ; Te0/3/0/3 ; Te0/3/0/11 Te0/0/0/11 Local Active 0x8000 Te0/1/0/11 Local Active 0x8000 Te0/2/0/3 Local Active 0x8000 Te0/2/0/11 Local Active 0x8000 Te0/3/0/3 Local Active 0x8000 Te0/3/0/11 Local Active 0x8000
Sheet1




It works only for E and F columns, need to en till the last non blank cells in column B
VBA Code:
Sub ExtractAndCombineperfect()


    ' Get values from E2 and F2
    Dim valueE As String
    Dim valueF As String

    valueE = Range("E2").Value
    valueF = Range("F2").Value

    ' Take the first 14 characters from each value
    Dim truncatedValueE As String
    Dim truncatedValueF As String

    truncatedValueE = Left(valueE, 14)
    truncatedValueF = Left(valueF, 14)

    ' Combine truncated values with a semicolon and put the result in G2
    Range("D2").Value = Application.WorksheetFunction.Trim(truncatedValueE & ";" & truncatedValueF)
End Sub
 

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type
In that case you copied the data incorrectly, as it does not work on the OP's data, it has the same problem as RobP's original code.
 
Upvote 0

Forum statistics

Threads
1,224,754
Messages
6,180,749
Members
452,996
Latest member
nelsonsix66

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top