I have multiple columns (15 to 16) of data ([see Image](https://i.stack.imgur.com/1Eygv.png)).

It has One number that is split into 3 columns Eg. 147 is split into three columns 1, 4, 7 and 268 is split into 2,6,8. Now i want to stack the data in a way as presented in [this image](https://i.stack.imgur.com/vlPWW.png)

For this I tried to concatenate the three columns to make a single digit such as 1,4,7 are combined to form 147 and 2,6,8 are combined to form 268. The code i have written has given output 148 and 268 but it has two empty columns in between them shown as [this](https://i.stack.imgur.com/BQPAG.png).

I am not able to stack these columns to get desired output. Please suggest any method to stack from input to desired output directly Or any amendment in my current code so that i get the concatenated data in sequential columns.

Note:- The number of rows and columns are variable not static.

```
Sub JoinAndCut()
Dim n As Long
Dim p, col As Long
Dim lastrow As Long
For p = 1 To 25 Step 3

lastrow = ThisWorkbook.Worksheets(2).Cells(Rows.count, p).End(xlUp).Row   '<== To Count number of rows in each column

For n = 2 To lastrow

Cells(n, p).Offset(, 25).Value = Cells(n, p).Value & Cells(n, p + 1).Value & Cells(n, p + 2).Value ' <=== Offset by 25 values so as they dont overlap the input

Next n
Next p

End Sub

Sub JoinAndCut()
Dim n As Long
Dim p, col As Long
Dim lastrow As Long
For p = 1 To 25 Step 3

lastrow = ThisWorkbook.Worksheets(2).Cells(Rows.count, p).End(xlUp).Row   '<== To Count number of rows in each column

For n = 2 To lastrow

Cells(n, p).Offset(, 25).Value = Cells(n, p).Value & Cells(n, p + 1).Value & Cells(n, p + 2).Value ' <=== Offset by 25 values so as they dont overlap the input

Next n
Next p

End Sub

```