我在excel中有一个字典,其中一个完整的字典条目占用一个单元格。我想把这个细胞分成两个细胞,第一个是语言1,第二个是语言2.
以下是字典的示例:
A 1.男性或正性原则,阳性2.凸起,凸起3.反应的感叹4.恐惧的感叹5.称呼粒子6.满族文字中的牙齿
A A a casual of casual response
A BUKDAN折叠纸的外边缘
JIJUN I ACANGGA是一个青铜识别代币,带有凸起的字符,用于在晚上进入城市
JILGAN音乐中的阳音
FA SERE ONGGOLO见afanggala
用于驾驶鸡只或鸟类的声音
TA(原子)骚动的声音
我想要的输出:
A | 1. the male or positive principle, yang 2. convex,
A A | an interjection of casual response
A I BUKDAN | the outside edge of a piece of folded paper
A JIJUN I ACANGGA | a bronze identification token with raised characters
A JILGAN | a yang tone in music
A FA SERE ONGGOLO | see afanggala
A SI | a sound used for driving chickens or birds
A TA | (onom.) the sound of a commotion
我需要一些条件来分裂这些细胞。拆分需要在每个条目中的第一个出现号码之前(如在第一个条目中),在第一个小写字母之前,或在“(”
之前发生。在条目中的最后一个大写字母之后将其拆分可能不起作用,因为大写字母也存在于“语言2”列中。
这可能吗?非常感谢所有帮助。
答案 0 :(得分:0)
Sub SeparateUpperCase()
Dim total As Integer
Dim i As Integer
Dim count As Integer
total = ActiveSheet.UsedRange.Rows.count
For i = 1 To total
'assume the input is in the 1st column and put output in 2nd and 3rd columns
count = GetUpperCaseNum(ActiveSheet.Cells(i, 1))
ActiveSheet.Cells(i, 2) = Trim(Left(ActiveSheet.Cells(i, 1), count))
ActiveSheet.Cells(i, 3) = Trim(Right(ActiveSheet.Cells(i, 1), Len(ActiveSheet.Cells(i, 1)) - count))
Next
End Sub
Function GetUpperCaseNum(str As String) As Integer
Dim i As Integer
Dim A As Integer, Z As Integer, Space As Integer
Dim tmp As Integer
A = Asc("A")
Z = Asc("Z")
Space = Asc(" ")
result = 0
For i = 1 To Len(str)
tmp = Asc(Mid(str, i, 1))
If Not (tmp >= A And tmp <= Z Or tmp = Space) Then 'just count UpperCase and Space
result = i - 1
Exit For
End If
Next
GetUpperCaseNum = result
End Function