Excel VBA
来源:互联网 发布:淘宝李宁是真的吗 编辑:程序博客网 时间:2024/05/17 05:15
添加工作表
Sheets.Add
ActiveSheet.Name = "汇总"
或者
Worksheets.AddActiveSheet.Name = "汇总"
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = "target"
Sub Excute_Click()
'原始注音音节数量
Dim orign_zy_syllable_coun
orign_zy_syllable_count = Cells(Rows.Count, 1).End(3).Row
'原始注音音节
Dim orign_zy_syllable As String
Dim new_zy_syllable As String
'新建工作表
Worksheets.Add(After:=Worksheets(Worksheets.Count)).Name = Worksheets.Count + 1
For i = 2 To orign_zy_syllable_count
orign_zy_syllable = Worksheets("拼音音节VS注音音节").Cells(i, 3).Value
new_zy_syllable = orign_zy_syllable & "0"
Cells(5 * (i - 2) + 1, 1).Value = 5 * (i - 2) + 1
Cells(5 * (i - 2) + 1, 2).Value = new_zy_syllable
Cells(5 * (i - 2) + 1, 3).Value = Convert_Unicode_Str(orign_zy_syllable, 0, 5 * (i - 2) + 1)
new_zy_syllable = orign_zy_syllable & "1"
Cells(5 * (i - 2) + 2, 1).Value = 5 * (i - 2) + 2
Cells(5 * (i - 2) + 2, 2).Value = new_zy_syllable
Cells(5 * (i - 2) + 2, 3).Value = Convert_Unicode_Str(orign_zy_syllable, 1, 5 * (i - 2) + 2)
new_zy_syllable = orign_zy_syllable & "2"
Cells(5 * (i - 2) + 3, 1).Value = 5 * (i - 2) + 2
Cells(5 * (i - 2) + 3, 2).Value = new_zy_syllable
Cells(5 * (i - 2) + 3, 3).Value = Convert_Unicode_Str(orign_zy_syllable, 2, 5 * (i - 2) + 3)
new_zy_syllable = orign_zy_syllable & "3"
Cells(5 * (i - 2) + 4, 1).Value = 5 * (i - 2) + 3
Cells(5 * (i - 2) + 4, 2).Value = new_zy_syllable
Cells(5 * (i - 2) + 4, 3).Value = Convert_Unicode_Str(orign_zy_syllable, 3, 5 * (i - 2) + 4)
new_zy_syllable = orign_zy_syllable & "4"
Cells(5 * (i - 2) + 5, 1).Value = 5 * (i - 2) + 4
Cells(5 * (i - 2) + 5, 2).Value = new_zy_syllable
Cells(5 * (i - 2) + 5, 3).Value = Convert_Unicode_Str(orign_zy_syllable, 4, 5 * (i - 2) + 5)
Next
End Sub
Public Function Convert_Unicode_Str(str As String, tone As Integer, lineNo As Integer)
'取得十六进制的UNICODE
Dim i As Long
Dim chrTmp As String
Dim ByteLower As String
Dim ByteUpper As String
Dim strReturn As String
strReturn$ = strReturn$ & "{ " & lineNo & ", { "
For i = 1 To Len(str)
chrTmp$ = Mid(str, i, 1)
ByteLower$ = Hex$(AscB(MidB$(chrTmp$, 1, 1)))
If Len(ByteLower$) = 1 Then
ByteLower$ = "0" & ByteLower$
End If
ByteUpper$ = Hex$(AscB(MidB$(chrTmp$, 2, 1)))
If Len(ByteUpper$) = 1 Then
ByteUpper$ = "0" & ByteUpper$
End If
strReturn$ = strReturn$ & "0x" & ByteUpper$ & ByteLower$ & ","
Next
If tone = 0 Then
strReturn$ = strReturn$ & "0x02D9" & ","
ElseIf tone = 1 Then
strReturn$ = strReturn$ & "0" & ","
ElseIf tone = 2 Then
strReturn$ = strReturn$ & "0x02CA" & ","
ElseIf tone = 3 Then
strReturn$ = strReturn$ & "0x02C7" & ","
Else
strReturn$ = strReturn$ & "0x02CB" & ","
End If
For i = Len(str) + 2 To 7
strReturn$ = strReturn$ & "0" & ","
Next
strReturn$ = strReturn$ & tone & "} },"
Convert_Unicode_Str = strReturn$
End Function
- Excel Vba
- excel VBA
- Excel VBA
- EXCEL+VBA
- Excel VBA
- Excel VBA
- Excel VBA
- VBA Excel
- Excel中的VBA编程
- VBA for EXCEL FAQ
- Microsoft Excel VBA Examples
- Excel VBA 重要参考
- excel 问题,vba
- EXCEL VBA中的类
- Excel VBA教程
- 用VBA处理Excel
- Excel VBA笔记
- Excel VBA笔记2
- jieba分词
- OpenStack Python SDK
- 2014Shanghai Online
- 总能不经意的发觉很多乐趣~
- MainWindow
- Excel VBA
- js获取页面及个元素高度、宽度
- 信号和槽机制
- 2016.7.28 笔记-struts领域对象(问题原因)
- SpringMVC上传下载
- UVALive6969 ZOJ3819 Average Score
- 错误
- Spark排错与优化
- 【Spring】基于注解的Spring AOP的配置和使用