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

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


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

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

【資料作者】:Aming.Ou

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

【資料語言】:中文

【資料格式】:DOC

【資料目錄和簡介】:

Excel VBA 宏工具

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

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


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

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

'用于統(tǒng)計某列每一行單元格中以“ ”(空格)分割開的元素有多少個,如統(tǒng)計Mcomcarrier中TCH個數(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("請輸入索引列:", "請輸入索引列的列號", 1)
nTch_Col = InputBox("請輸入空格為分隔符的數(shù)據(jù)的列號:", "請輸入數(shù)據(jù)所在列的列號", 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ū)或者頻點的格式轉(zhuǎn)換,如把鄰區(qū)關(guān)系轉(zhuǎn)為鄰區(qū)對的形式
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("請輸入CELL號的列號:", "請輸入CELL號的列號", 1)
nTch_Col = InputBox("請輸入DCHNO的列號:", "請輸入DCHNO的列號", 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ū)或者頻點的格式轉(zhuǎn)換,如把鄰區(qū)對轉(zhuǎn)為一個小區(qū)對應(yīng)多個鄰區(qū)形式,又或者是把RLCFP指令得到的頻點按小區(qū)轉(zhuǎn)為一行
'處理前,需要對關(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("請輸入CELL號的列號:", "請輸入CELL號的列號", 1)
nTch_Col = InputBox("請輸入DCHNO的列號:", "請輸入DCHNO的列號", 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("請輸入BSC的列號:", "請輸入BSC的列號", 1)
nTch_Col = InputBox("請輸入CMD的列號:", "請輸入CMD的列號", 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

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





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


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

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

    對本帖內(nèi)容的看法? 我要點評





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

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

    (勾選中文件為要刪除文件)


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

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