Add line breaks in cell to 1000 rows of data

前端 未结 3 370
囚心锁ツ
囚心锁ツ 2021-01-17 01:45

I am currently using the below code to add a line break to cell data in column C and copy it to column K. I need to apply line breaks to a range of data. I have 1000 rows of

3条回答
  •  爱一瞬间的悲伤
    2021-01-17 01:54

    Try this:

    Sub copyAndNewLine()
    'copy column C to K
    Columns("C").Copy Destination:=Columns("K")
    
    'loop through all cells in K and add new line
    For i = 2 To Cells(Rows.Count, "K").End(xlUp).Row
        Cells(i, "K").Value = Cells(i, "K").Value & vbCrLf
    Next i
    End Sub
    

提交回复
热议问题