Pages

Thursday, April 16, 2020

Concatenate Multy Coloumn - vba excel



'Gabung text data kolom A1 sampai P1
‘R1 hasil gabungan text disimpan


Sub Concatenate_MultyColom ()
Sub ConcatenateRange()
Sheets("SHEET1").Range("R1:R20").Value = ""
Dim val As String
Dim iLastRow As Long
Dim iLastCol As Long
Dim i As Long
Dim j As Long
iLastRow = Cells.Find(What:="*", _
After:=Range("P1"), _
SearchOrder:=xlByRows, _
SearchDirection:=xlPrevious).Row
For i = 1 To iLastRow
iLastCol = Cells(i, Columns.Count).End(xlToLeft).Column
val = ""
For j = 2 To iLastCol
val = val & Cells(i, j)
Next j
Cells(i, "R").Value = val
Next i
End Sub


1 comment:

  1. maaf bertanya min, untuk seterusnya pd baris yg dibawahnya A1, A2 dst nya mohon kelanjutan codenya, maaf pemula.

    ReplyDelete