楼主 罗刚君 |
Q:图中A列的值转换成BC列的样式,如何实现 A:用VBA中的数组,可以快速实现 Sub 试试() Dim useRows As Integer, temp() As String, arr(), k useRows = Sheets("sheet1").[A1].CurrentRegion.Rows.Count For i = 1 To useRows temp = Split(Range("a" & i).Text, ",") For j = 1 To UBound(temp) k = k + 1 ReDim Preserve arr(1 To 2, 1 To k) arr(1, k) = temp(0) arr(2, k) = temp(j) Next Next With Range("B1:C" & k) .Borders.LineStyle = xlContinuous .HorizontalAlignment = xlCenter .Value = WorksheetFunction.Transpose(arr) End With End Sub数组.png 数组应用.rar |
2楼 biaotiger1 |
一个单元格内,多个相同字符分隔的字符串,通过VBA代码转换为列向独立排列。 |