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
| Sub test()
Dim i As Integer, j As Integer, k As Integer, Result As String
Dim derL As Integer, derC As Integer
derL = Cells(Rows.Count, 1).End(xlUp).Row
derC = Cells(1, Columns.Count).End(xlToLeft).Column
For j = 1 To derC
derL = Cells(Rows.Count, j).End(xlUp).Row
For i = 1 To derL
If Cells(i, j).Text <> "" Then
If Cells(i, j) = "=" Then
Result = Result & " = ("
For k = Cells(i, j).Row + 1 To derL
If k = Cells(i, j).Row + 1 Then
Result = Result & Cells(k, j)
Else
Result = Result & ";" & Cells(k, j)
End If
Next
Result = Result & ")"
Exit For
Else
Result = Result & " " & Cells(i, j)
End If
End If
Next
Next
MsgBox Trim(Result)
End Sub |
Partager