[ 初めての方へ | 一覧(最新更新順) | 全文検索 | 過去ログ ]
『初心者』(ゆうり)
土曜日はありがとうございました。
Sheets("りんご").Select
Range("B1").Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range _ ("E2"), Order2:=xlAscending, Key3:=Range("F2"), Order3:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, DataOption3:=xlSortNormal Sheets("オレンジ").Select Range("B1").Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range( _ "E2"), Order2:=xlAscending, Key3:=Range("F2"), Order3:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, DataOption3:=xlSortNormal Sheets("うめ").Select Range("B1").Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range _ ("E2"), Order2:=xlAscending, Key3:=Range("F2"), Order3:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, DataOption3:=xlSortNormal Sheets("とまと").Select Range("B1").Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range _ ("E2"), Order2:=xlAscending, Key3:=Range("F2"), Order3:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, DataOption3:=xlSortNormal Sheets("きゅうり").Select Range("B1").Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range _ ("E2"), Order2:=xlAscending, Key3:=Range("F2"), Order3:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, DataOption3:=xlSortNormal Sheets("なす").Select Range("B1").Sort Key1:=Range("D2"), Order1:=xlAscending, Key2:=Range _ ("E2"), Order2:=xlAscending, Key3:=Range("F2"), Order3:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, DataOption3:=xlSortNormal End Sub
上記のコード
を土曜日教えて頂いた様にまとめたいのですが。
教えていただけますか?
お願いします。
ご指名は本人以外回答つけにくくなります。 また、『』の中は「相談内容の要約」を書きなさい、というお約束になっています。 「初心者」表明してもやさしい答えが返ってくるとは限りません。 Sub test() Call sort_test("りんご") Call sort_test("オレンジ") Call sort_test("うめ") Call sort_test("とまと") Call sort_test("きゅうり") Call sort_test("なす") End Sub
Private Sub sort_test(ByVal sh As String) With Sheets(sh) .Range("B1").Sort Key1:=.Range("D2"), Order1:=xlAscending, Key2:=.Range _ ("E2"), Order2:=xlAscending, Key3:=.Range("F2"), Order3:=xlAscending, _ Header:=xlGuess, OrderCustom:=1, MatchCase:=False, Orientation:= _ xlTopToBottom, SortMethod:=xlPinYin, DataOption1:=xlSortNormal, _ DataOption2:=xlSortNormal, DataOption3:=xlSortNormal End With End Sub (みやほりん)(-_∂)b
ありがとうございます。上記のコードが求めていたものでした。
色々勉強になりました。
今後はみやほりんさんの言われる通り使用させて頂ければと思います^^
感謝です
[ 一覧(最新更新順) ]
YukiWiki 1.6.7 Copyright (C) 2000,2001 by Hiroshi Yuki.
Modified by kazu.