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 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
| Sub concaten_1()
Dim i As Long
Range("A22") = "this is the end my friend"
Do
i = i + 1
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" And Cells(i, 1).Offset(2, 0).Value = "" And Cells(i, 1).Offset(3, 0).Value = "" And Cells(i, 1).Offset(4, 0).Value = "" And Cells(i, 1).Offset(5, 0).Value = "" And Cells(i, 1).Offset(6, 0).Value = "" And Cells(i, 1).Offset(7, 0).Value = "" And Cells(i, 1).Offset(8, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1]&"" / ""&R[2]C[-1]&"" / ""&R[3]C[-1]&"" / ""&R[4]C[-1]&"" / ""&R[5]C[-1]&"" / ""&R[6]C[-1]&"" / ""&R[7]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" And Cells(i, 1).Offset(2, 0).Value = "" And Cells(i, 1).Offset(3, 0).Value = "" And Cells(i, 1).Offset(4, 0).Value = "" And Cells(i, 1).Offset(5, 0).Value = "" And Cells(i, 1).Offset(6, 0).Value = "" And Cells(i, 1).Offset(7, 0).Value = "" And Cells(i, 1).Offset(8, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1]&"" / ""&R[2]C[-1]&"" / ""&R[3]C[-1]&"" / ""&R[4]C[-1]&"" / ""&R[5]C[-1]&"" / ""&R[6]C[-1]&"" / ""&R[7]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" And Cells(i, 1).Offset(2, 0).Value = "" And Cells(i, 1).Offset(3, 0).Value = "" And Cells(i, 1).Offset(4, 0).Value = "" And Cells(i, 1).Offset(5, 0).Value = "" And Cells(i, 1).Offset(6, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1]&"" / ""&R[2]C[-1]&"" / ""&R[3]C[-1]&"" / ""&R[4]C[-1]&"" / ""&R[5]C[-1]&"" / ""&R[6]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" And Cells(i, 1).Offset(2, 0).Value = "" And Cells(i, 1).Offset(3, 0).Value = "" And Cells(i, 1).Offset(4, 0).Value = "" And Cells(i, 1).Offset(5, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1]&"" / ""&R[2]C[-1]&"" / ""&R[3]C[-1]&"" / ""&R[4]C[-1]&"" / ""&R[5]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" And Cells(i, 1).Offset(2, 0).Value = "" And Cells(i, 1).Offset(3, 0).Value = "" And Cells(i, 1).Offset(4, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1]&"" / ""&R[2]C[-1]&"" / ""&R[3]C[-1]&"" / ""&R[4]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" And Cells(i, 1).Offset(2, 0).Value = "" And Cells(i, 1).Offset(3, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1]&"" / ""&R[2]C[-1]&"" / ""&R[3]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" And Cells(i, 1).Offset(2, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1]&"" / ""&R[2]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value = "" Then
Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1]&"" / ""&R[1]C[-1])"
Else
If Cells(i, 1).Value <> "" And Cells(i, 1).Offset(1, 0).Value <> "" Then Cells(i, 3).FormulaR1C1 = "=CONCATENATE(RC[-1])"
End If
End If
End If
End If
End If
End If
End If
End If
Loop Until Cells(i, 1).Value = "this is the end my friend"
End Sub |
Partager