不確定打印每一行是什麼意思。
您可以遍歷列 'A' 的所有值,並在這樣的下一列 'd' 串連值:
Sub Macro1()
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Dim rRng As Range
Set rRng = Range("A1:A" & LastRow)
For Each cell In rRng.Cells
cell.Offset(0, 3).Value = "A quantity of " & cell.Value & " must be consumed by " & cell.Offset(0, 1).Value & " product will be " & cell.Offset(0, 2).Value
Next
End Sub
結果是這樣的:
編輯
既然你提到了一個新的行字符,我會假設你想要一個單元格中的所有文本出於某種原因。試試這個:
Sub Macro1()
With ActiveSheet
LastRow = .Cells(.Rows.Count, "A").End(xlUp).Row
End With
Dim rRng As Range
Set rRng = Range("A1:A" & LastRow)
Dim result As Range
Set result = Range("D1")
result.Value = ""
For Each cell In rRng.Cells
result.Value = Range("D1").Value & "A quantity of " & cell.Value & " must be consumed by " & cell.Offset(0, 1).Value & " product will be " & cell.Offset(0, 2).Value & Chr(10)
Next
End Sub
結果看現在這個樣子:
中放置文本到一個單元格與回車見編輯。 –