標題:
[發問]
想請問兩列其中有亂數空白格問題
[打印本頁]
作者:
albertbug
時間:
2011-7-28 18:54
標題:
想請問兩列其中有亂數空白格問題
各位好
我想請問 我有些數字想處理
甲 乙 排列好
5
5 8 8
9 9
4 5 4
5
3
3 5 5
如上圖 有些位置是空格 但是我要根據A1 B1 A2 B2 A3 B3
一起排列在C那邊(空格不排列)
這樣應該要怎麼做比較方便 我有傳附件 再麻煩各位大大了
感謝
作者:
GBKEE
時間:
2011-7-28 20:56
回復
1#
albertbug
Sub Ex()
Dim D As Object, E As Range
Set D = CreateObject("SCRIPTING.DICTIONARY")
For Each E In Range("A2:B30")
If E <> "" Then D(E) = E.Value
Next
[D2:D65536] = ""
[D2].Resize(D.Count) = Application.Transpose(D.ITEMS)
End Sub
複製代碼
作者:
Hsieh
時間:
2011-7-28 21:21
Sub Ex()
Dim Ay()
ar = [A1].Resize(ActiveSheet.UsedRange.Rows.Count, 2)
For i = 2 To UBound(ar, 1)
For j = 1 To 2
If ar(i, j) <> "" Then
ReDim Preserve Ay(s)
Ay(s) = ar(i, j)
s = s + 1
End If
Next
Next
[D1:D65536] = ""
[D2].Resize(s, 1) = Application.Transpose(Ay)
End Sub
複製代碼
回復
1#
albertbug
作者:
albertbug
時間:
2011-7-29 00:37
感謝GBKEE & Hsieh的教導感謝
但是可以在問個很蠢的問題
如何執行EX()
是利用新增表單Private Sub CommandButton1_Click()
去Call ex()嗎
還是要如何執行 XD 感謝 希望大大再教導
作者:
GBKEE
時間:
2011-7-29 06:23
回復
4#
albertbug
Private Sub CommandButton1_Click()
Dim D As Object, E As Range
Set D = CreateObject("SCRIPTING.DICTIONARY")
For Each E In Range("A2:B30")
If E <> "" Then D(E) = E.Value
Next
[D2:D65536] = ""
[D2].Resize(D.Count) = Application.Transpose(D.ITEMS)
End Sub
複製代碼
作者:
albertbug
時間:
2011-7-29 14:46
感謝GBKEE大大
歡迎光臨 麻辣家族討論版版 (http://forum.twbts.com/)