回答編集履歴
1
コード追記
test
CHANGED
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
```
|
12
12
|
|
13
|
-
Split関数を使った方
|
13
|
+
Split関数を使った方が記述が楽です。
|
14
14
|
|
15
15
|
```VBA
|
16
16
|
|
@@ -19,3 +19,35 @@
|
|
19
19
|
Application.AddCustomList ListArray:=Split("A,B,C, 中略 ,B1,B2,B3",",")
|
20
20
|
|
21
21
|
```
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
Excel2007以降なら、Sortオプジェクトを使った方がいいかも。
|
26
|
+
|
27
|
+
|
28
|
+
|
29
|
+
```vba
|
30
|
+
|
31
|
+
With Worksheets("Sheet1").Sort
|
32
|
+
|
33
|
+
.SortFields.Clear
|
34
|
+
|
35
|
+
.SortFields.Add Key:=Range("J1"), _
|
36
|
+
|
37
|
+
CustomOrder:="A,B,C, 中略 ,B1,B2,B3"
|
38
|
+
|
39
|
+
.SetRange Range("A:W")
|
40
|
+
|
41
|
+
.Header = xlGuess
|
42
|
+
|
43
|
+
.Orientation = xlTopToBottom
|
44
|
+
|
45
|
+
.Apply
|
46
|
+
|
47
|
+
End With
|
48
|
+
|
49
|
+
```
|
50
|
+
|
51
|
+
参考リンク
|
52
|
+
|
53
|
+
[Office TANAKA - Excel VBA Tips[Excel 2007のSortオブジェクト]](http://officetanaka.net/excel/vba/tips/tips148.htm)
|