我的工作表中有很多这样的行
Castle Green Taunton TA1 1NF UK
11 Bacon Ln Moranbah QLD 4744 Australia
40 Memory Ln Hunter River PE C0A 1N0 Canada
Fidel Velazquez Av Fidel Velázquez #3000 Col. Central Central 64190 Monterrey Mexico
我需要将每一行的最后一个单元格收集到一个新列中。因此,新列应如下所示:
UK
Australia
Canada
Mexico
非常感谢。
答案 0 :(得分:2)
答案 1 :(得分:1)
要使用vba,可以使用以下代码。 +2插入空白列以分隔数据。
Dim ws As Worksheet, lRow As Long, lCol As Long
Set ws = ThisWorkbook.ActiveSheet
lRow = ws.Cells(Rows.Count, "A").End(xlUp).Row
lCol = ws.UsedRange.Columns.Count
For x = 2 To lRow
ws.Cells(x, lCol + 2).Value = ws.Cells(x, Columns.Count).End(xlToLeft).Value
Next x