MSCBSC 移動(dòng)通信論壇
搜索
登錄注冊(cè)
網(wǎng)絡(luò)優(yōu)化工程師招聘專欄 4G/LTE通信工程師最新職位列表 通信實(shí)習(xí)生/應(yīng)屆生招聘職位

  • 閱讀:3437
  • 回復(fù):1
縱橫(行列)轉(zhuǎn)換工具
aming.ou
療養(yǎng)院干部
鎵嬫満鍙風(fēng)爜宸查獙璇? style=


 發(fā)短消息    關(guān)注Ta 

積分 15604
帖子 428
威望 12130 個(gè)
禮品券 5 個(gè)
專家指數(shù) 6
注冊(cè) 2006-7-7
專業(yè)方向  愛(ài)立信無(wú)線優(yōu)化
回答問(wèn)題數(shù) 0
回答被采納數(shù) 0
回答采納率 0%
 
發(fā)表于 2012-04-26 13:43:13  只看樓主  QQ
【資料名稱】:縱橫(行列)轉(zhuǎn)換工具

【資料作者】:Aming.Ou

【資料日期】:2012-04-26

【資料語(yǔ)言】:中文

【資料格式】:DOC

【資料目錄和簡(jiǎn)介】:

Excel VBA 宏工具

功能說(shuō)明:本Excel是多個(gè)宏功能的載體,可以完成
1、把列數(shù)據(jù)變?yōu)樾袛?shù)據(jù),空格為分隔符" "
2、把空格" "分隔符的行數(shù)據(jù)變?yōu)榱袛?shù)據(jù)
3、為OPS批處理文件增加CONNECT指令
4、統(tǒng)計(jì)空格" "分隔符的元素個(gè)數(shù)

使用說(shuō)明:
同時(shí)打開(kāi)本Excel【縱橫(行列)轉(zhuǎn)換工具】和要處
的Excel,并切換到要處理的Sheet界面,然
后按[alt + F8]激活VBA宏,選擇需要的功能,
按提示需要處理的列號(hào),就可以完成了。


版權(quán)所有:Aming_ou@Hotmail.com

**********************************************************
代碼公開(kāi),大家在使用前可以查看代碼,每個(gè)功能前都說(shuō)明。
行列轉(zhuǎn)換,處理時(shí)間完全可以忽略,因?yàn)閷?duì)于Excel 2007的100萬(wàn)行數(shù)據(jù)也僅僅需要30秒左右
如果不想浪費(fèi)威望下載,大家可以自行在excel中新建模塊,加入以下代碼:

'用于統(tǒng)計(jì)某列每一行單元格中以“ ”(空格)分割開(kāi)的元素有多少個(gè),如統(tǒng)計(jì)Mcomcarrier中TCH個(gè)數(shù)
Sub CountNum()
On Error GoTo ErrorExit
Dim nBcch_Col As Integer, nTch_Col As Integer
Dim oBcch_Col As Integer, oTch_Col As Integer
Dim Cell_Col As Integer, Result_Col As Integer, Result_Col2 As Integer, sResult_TCH As String
Dim nTch_array() As String
Dim oTch_array() As String
Dim tch1 As String, tch2 As String
Dim isFindTch As Boolean
Dim x1 As Long, x2 As Long, x3 As Long
'Cell_Col = 1
Cell_Col = InputBox("請(qǐng)輸入索引列:", "請(qǐng)輸入索引列的列號(hào)", 1)
nTch_Col = InputBox("請(qǐng)輸入空格為分隔符的數(shù)據(jù)的列號(hào):", "請(qǐng)輸入數(shù)據(jù)所在列的列號(hào)", 0)
If (nTch_Col > 0) And (Cell_Col > 0) Then
x1 = 1
Do Until Cells(1, x1).Value = ""
x1 = x1 + 1
Loop

If x1 >= 1 Then
Result_Col = x1 + 7
Columns(Result_Col).ClearContents
Cells(1, Result_Col).Value = "Num"
x1 = 2
Do Until (Cells(x1, Cell_Col).Value = "")
If Trim(Cells(x1, nTch_Col).Value) = "" Then
sResult_TCH = 0
Else
nTch_array() = Split(Trim(Cells(x1, nTch_Col).Value), " ")
sResult_TCH = UBound(nTch_array) + 1
End If
Cells(x1, Result_Col).Value = sResult_TCH
x1 = x1 + 1
Loop
End If
Cells(1, Result_Col).Select
MsgBox "OK"
End If
Exit Sub
ErrorExit:
MsgBox "Some Error Exist"
End Sub

'行轉(zhuǎn)列,也叫橫轉(zhuǎn)縱,多用于鄰區(qū)或者頻點(diǎn)的格式轉(zhuǎn)換,如把鄰區(qū)關(guān)系轉(zhuǎn)為鄰區(qū)對(duì)的形式
Sub Row2Col()
On Error GoTo Err
Dim x1 As Long, x2 As Long, x3 As Long, Result_Row As Long
Dim Cell_Col As Long, nTch_Col As Long
Dim nTch_array() As String

Cell_Col = InputBox("請(qǐng)輸入CELL號(hào)的列號(hào):", "請(qǐng)輸入CELL號(hào)的列號(hào)", 1)
nTch_Col = InputBox("請(qǐng)輸入DCHNO的列號(hào):", "請(qǐng)輸入DCHNO的列號(hào)", 0)
If nTch_Col > 0 Then
x1 = 1
Do Until ((Cells(x1, Cell_Col).Value = "") And (Cells(x1 + 3, Cell_Col).Value = ""))
x1 = x1 + 1
Loop
If x1 > 2 Then
Result_Row = x1 + 5
x1 = 2
Do Until ((Cells(x1, Cell_Col).Value = "") And (Cells(x1 + 3, Cell_Col).Value = ""))
If Trim(Cells(x1, nTch_Col).Value <> "") Then
nTch_array() = Split(Trim(Cells(x1, nTch_Col).Value), " ")
For x2 = 0 To UBound(nTch_array)
If Trim(nTch_array(x2)) <> "" Then
Cells(Result_Row, Cell_Col).Value = Cells(x1, Cell_Col).Value
Cells(Result_Row, nTch_Col).Value = nTch_array(x2)
Result_Row = Result_Row + 1
End If
Next
End If
x1 = x1 + 1
Loop

End If
End If
MsgBox "OK"
Exit Sub
Err:
MsgBox "SomeThing is Wrong!"
End Sub
'列轉(zhuǎn)行,也叫縱轉(zhuǎn)橫,多用于鄰區(qū)或者頻點(diǎn)的格式轉(zhuǎn)換,如把鄰區(qū)對(duì)轉(zhuǎn)為一個(gè)小區(qū)對(duì)應(yīng)多個(gè)鄰區(qū)形式,又或者是把RLCFP指令得到的頻點(diǎn)按小區(qū)轉(zhuǎn)為一行
'處理前,需要對(duì)關(guān)鍵列進(jìn)行排序
Sub Col2Row()
On Error GoTo Err
Dim x1 As Long, x2 As Long, x3 As Long, Result_Row As Long, Result_Col As Long
Dim Cell_Col As Integer, nTch_Col As Integer, tch1 As String, strCell As String
Dim nTch_array() As String

Cell_Col = InputBox("請(qǐng)輸入CELL號(hào)的列號(hào):", "請(qǐng)輸入CELL號(hào)的列號(hào)", 1)
nTch_Col = InputBox("請(qǐng)輸入DCHNO的列號(hào):", "請(qǐng)輸入DCHNO的列號(hào)", 0)
If nTch_Col > 0 Then

x1 = 1
Do Until ((Cells(1, x1).Value = "") And (Cells(1, x1 + 3).Value = ""))
x1 = x1 + 1
Loop
If x1 > 1 Then
Result_Row = 2
Result_Col = x1 + 5
x1 = 2
Do Until ((Cells(x1, Cell_Col).Value = "") And (Cells(x1 + 3, Cell_Col).Value = ""))
strCell = Cells(x1, Cell_Col).Value
If Trim(strCell) <> "" Then
tch1 = ""
Do Until (Cells(x1, Cell_Col).Value <> strCell)
If Trim(Cells(x1, nTch_Col).Value) <> "" Then
tch1 = tch1 & " " & Trim(Cells(x1, nTch_Col).Value)
End If
x1 = x1 + 1
Loop
If Trim(tch1) <> "" Then
Cells(Result_Row, Result_Col).Value = Trim(strCell)
Cells(Result_Row, Result_Col + 1).Value = Trim(tch1)
Result_Row = Result_Row + 1
End If
Else
x1 = x1 + 1
End If
Loop
End If
Else
MsgBox "No Check!"
Exit Sub
End If
MsgBox "OK"
Exit Sub
Err:
MsgBox "SomeThing is Wrong!"
End Sub

Sub Add_ConnectBSC()
On Error GoTo Err
Dim x1 As Long, x2 As Long, x3 As Long, Result_Row As Integer, Result_Col As Integer
Dim Cell_Col As Integer, nTch_Col As Integer, tch1 As String, strCell As String
Dim nTch_array() As String

Cell_Col = InputBox("請(qǐng)輸入BSC的列號(hào):", "請(qǐng)輸入BSC的列號(hào)", 1)
nTch_Col = InputBox("請(qǐng)輸入CMD的列號(hào):", "請(qǐng)輸入CMD的列號(hào)", 0)
If nTch_Col > 0 Then

x1 = 1
Do Until ((Cells(1, x1).Value = "") And (Cells(1, x1 + 3).Value = ""))
x1 = x1 + 1
Loop
If x1 > 1 Then
Result_Row = 2
Result_Col = x1 + 5
x1 = 2
Do Until ((Cells(x1, Cell_Col).Value = "") And (Cells(x1 + 3, Cell_Col).Value = ""))
strCell = Trim(Cells(x1, Cell_Col).Value)
If (strCell <> "") And (strCell <> Trim(Cells(x1 - 1, Cell_Col).Value)) Then
Rows(x1).Select
Selection.Insert Shift:=xlDown
Selection.Insert Shift:=xlDown
Cells(x1 + 1, nTch_Col).Value = "@CONNECT(""" & Cells(x1 + 3, Cell_Col).Value & """)"
x1 = x1 + 3
Else
x1 = x1 + 1
End If
Loop
End If
Else
MsgBox "No Add!"
Exit Sub
End If
MsgBox "OK"
Exit Sub
Err:
MsgBox "SomeThing is Wrong!"
End Sub

查看積分策略說(shuō)明
附件下載列表:
2012-4-26 13:43:13  下載次數(shù): 175
縱橫(行列)轉(zhuǎn)換工具.xls (41 KB)
掃碼關(guān)注5G通信官方公眾號(hào),免費(fèi)領(lǐng)取以下5G精品資料
  • 1、回復(fù)“YD5GAI”免費(fèi)領(lǐng)取《中國(guó)移動(dòng):5G網(wǎng)絡(luò)AI應(yīng)用典型場(chǎng)景技術(shù)解決方案白皮書
  • 2、回復(fù)“5G6G”免費(fèi)領(lǐng)取《5G_6G毫米波測(cè)試技術(shù)白皮書-2022_03-21
  • 3、回復(fù)“YD6G”免費(fèi)領(lǐng)取《中國(guó)移動(dòng):6G至簡(jiǎn)無(wú)線接入網(wǎng)白皮書
  • 4、回復(fù)“LTBPS”免費(fèi)領(lǐng)取《《中國(guó)聯(lián)通5G終端白皮書》
  • 5、回復(fù)“ZGDX”免費(fèi)領(lǐng)取《中國(guó)電信5G NTN技術(shù)白皮書
  • 6、回復(fù)“TXSB”免費(fèi)領(lǐng)取《通信設(shè)備安裝工程施工工藝圖解
  • 7、回復(fù)“YDSL”免費(fèi)領(lǐng)取《中國(guó)移動(dòng)算力并網(wǎng)白皮書
  • 8、回復(fù)“5GX3”免費(fèi)領(lǐng)取《 R16 23501-g60 5G的系統(tǒng)架構(gòu)1
  • 對(duì)本帖內(nèi)容的看法? 我要點(diǎn)評(píng)





    Aming.Ou QQ3364776 MSN: Aming_ou@hotmail.com 無(wú)線網(wǎng)絡(luò)優(yōu)化+網(wǎng)優(yōu)軟件開(kāi)發(fā)
    [充值威望,立即自動(dòng)到帳] [VIP貴賓權(quán)限+威望套餐] 另有大量?jī)?yōu)惠贈(zèng)送活動(dòng),請(qǐng)光臨充值中心
    充值擁有大量的威望和最高的下載權(quán)限,下載站內(nèi)資料無(wú)憂
    michell11
    鉆石會(huì)員
    鎵嬫満鍙風(fēng)爜宸查獙璇? style=


     發(fā)短消息    關(guān)注Ta 

    公益·慈善勛章   紀(jì)念勛章·七周年   公益·環(huán)保勛章  
    積分 13604
    帖子 2572
    威望 101464 個(gè)
    禮品券 80 個(gè)
    專家指數(shù) 350
    注冊(cè) 2006-10-15
    專業(yè)方向  網(wǎng)絡(luò)優(yōu)化
    回答問(wèn)題數(shù) 0
    回答被采納數(shù) 0
    回答采納率 0%
     
    發(fā)表于 2012-08-30 09:30:47 
    很好,謝謝分享……

    對(duì)本帖內(nèi)容的看法? 我要點(diǎn)評(píng)





     
    [立即成為VIP會(huì)員,百萬(wàn)通信專業(yè)資料立即下載,支付寶、微信付款,簡(jiǎn)單、快速!]

    快速回復(fù)主題    
    標(biāo)題
    內(nèi)容
     上傳資料請(qǐng)點(diǎn)左側(cè)【添加附件】

    (勾選中文件為要?jiǎng)h除文件)


    當(dāng)前時(shí)區(qū) GMT+8, 現(xiàn)在時(shí)間是 2025-02-24 10:05:48
    渝ICP備11001752號(hào)  Copyright @ 2006-2016 mscbsc.com  本站統(tǒng)一服務(wù)郵箱:mscbsc@163.com

    Processed in 0.430747 second(s), 17 queries , Gzip enabled
    TOP
    清除 Cookies - 聯(lián)系我們 - 移動(dòng)通信網(wǎng) - 移動(dòng)通信論壇 - 通信招聘網(wǎng) - Archiver