我从在线商店导出一个订单,将变量导出为.csv文件中的单个单元格。
tier: Elite | division: Male/Male Team | captain shirt size: Large | teammate shirt size: XLarge | Team Name: Terrible 2's | Participant/Volunteer Waiver & Liability Release Captain's Full Name: Craig Carroll | Participant/Volunteer Waiver & Liability Release Teammate's Full Name: Ashley Carroll | Waiver & Release of All Claims & Assumption of Risk Captain's Intials: cc | Waiver & Release of All Claims & Assumption of Risk Teammate's Initials: ac | Age Requirement: Yes
这是它导出到一个单元格的内容。有没有办法使单词前面的:成为标题,如在A1中,和文本在|之前成为A2的价值?我已经使用了text to columns功能,但它创建了格式为tier:Elite
的单元格,依此类推。有关400个订单或订单项的解决方案的任何建议吗?
期望
等等
答案 0 :(得分:2)
我建议采取以下步骤:
|
作为分隔符:
作为分隔符数据最终会采用以下格式:
tier Elite
division Male/Male Team
captain shirt size Large
teammate shirt size XLarge
Team Name Terrible 2's
...
(仅显示前五行,因为其他行中有大量文字)
答案 1 :(得分:0)
此宏假设原始数据位于 Sheet1 的 A 列中。重组后的数据将放在 Sheet2 :
中Sub ReOrganize()
Dim N As Long, i As Long, K As Long
N = Cells(Rows.Count, "A").End(xlUp).Row
K = 1
For i = 1 To N
ary = Split(Cells(i, "A").Value, "|")
For Each a In ary
bry = Split(a, ":")
With Sheets("Sheet2")
.Cells(K, 1).Value = bry(0)
.Cells(K, 2).Value = bry(1)
K = K + 1
End With
Next a
Next i
End Sub