• 締切済み

表計算

Sub TaskManager() Dim i As Integer Dim Maxval As Integer Dim Counter As Integer Dim AtoShoriFlg As String Set SH1 = Worksheets("Sheet1") Set SH2 = Worksheets("Sheet2") Maxval = WorksheetFunction.Max(Range("B:B")) Maxval = Maxval + 1 '初期値設定 i = 7 AtoShoriFlg = "ON" Counter = 1 Do While Cells(i, 4).Value <> "end" Select Case Cells(i, 4) Case Is = "新規エントリー" AtoShoriFlg = "OFF" i = i + 1 Case Is = "" Cells(i - 1, 4).Copy Cells(i, 4) Cells(i, 4).Font.Color = RGB(255, 255, 255) SH1.Range(SH1.Cells(i, 2), SH1.Cells(i, 6)).Borders(xlEdgeTop).LineStyle = xlLineStyleNone Case Is <> Cells(i - 1, 4) SH1.Range(SH1.Cells(i, 2), SH1.Cells(i, 6)).Borders(xlEdgeTop).LineStyle = xlContinuous SH1.Range(SH1.Cells(i, 2), SH1.Cells(i, 6)).Font.Color = RGB(0, 0, 0) If Cells(i, 2) = "" Then Cells(i, 2) = Maxval Maxval = Maxval + 1 End If Counter = 1 Case Else SH1.Range(SH1.Cells(i, 2), SH1.Cells(i, 6)).Borders(xlEdgeTop).LineStyle = xlLineStyleNone End Select If Cells(i, 2).Value = "" Then Cells(i, 2) = Cells(i - 1, 2).Value Cells(i, 2).Font.Color = RGB(255, 255, 255) End If If Cells(i, 3).Value = "" And Counter <> 1 Then Cells(i, 3) = Cells(i - 1, 3).Value Cells(i, 3).Font.Color = RGB(255, 255, 255) End If If AtoShoriFlg = "ON" Then Cells(i, 7) = Counter Counter = Counter + 1 End If i = i + 1 Loop SH1.Range(SH1.Cells(i, 2), SH1.Cells(i, 6)).Borders(xlEdgeTop).LineStyle = xlContinuous If AtoShoriFlg = "ON" Then SH2.Range("B2:F5").Copy Destination:=SH1.Cells(i, 2) End If End Sub

みんなの回答

  • imogasi
  • ベストアンサー率27% (4737/17068)
回答No.1

このようにコード(これも我流だろう)だけあげて、(1)したいことの文章による説明もなく、(2)データ例も出さ、(3)エラーが出たとかいう言及もない質問は、おかしいのでは。回答者を、質問すれば、コードを無料で作ってくれる、ありがたい小間使いのように考えているのではないか。 標題も「表計算」だけでは、質問の中身の多少なりともの参考にもならない。 幾らOKWAVEの仕組は、感謝経済と言われてもね。言っても無駄で、スルーすればしまいなのだが、最近画像だけ貼り付けなど、こういうのが多い。

関連するQ&A

  • すべてのシートでマクロを実行したい

    以下のプログラムでは、選択したシートのみマクロが動作しています。ネット検索で見よう見まねで作ったため何がまちがっているのかわかりません。ご教示いただけるとありがたいです。 ・月の予定表で利用者が休みの日に斜線を引くマクロ ・入力ミスを防ぐためシート保護をしている Sub すべてのシート() Dim s As Worksheet For Each s In Worksheets s.Select Call 斜線 Next End Sub Sub 斜線() ActiveSheet.Unprotect Password:="1234" For i = 1 To Range("E10").End(xlDown).Row Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlNone If Range("E10").Value = 0 Then Exit Sub If Cells(i, "E").Value = "日" And Range("BP9").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If If Cells(i, "E").Value = "月" And Range("BP10").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If If Cells(i, "E").Value = "火" And Range("BP11").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If If Cells(i, "E").Value = "水" And Range("BP12").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If If Cells(i, "E").Value = "木" And Range("BP13").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If If Cells(i, "E").Value = "金" And Range("BP14").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If If Cells(i, "E").Value = "土" And Range("BP15").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If If Cells(i, "AY").Value = "祝日" And Range("BP16").Value = 0 Then Range("AS" & i).Borders(xlDiagonalUp).LineStyle = xlContinuous End If Next i ActiveSheet.Protect Password:="1234" End Sub

  • エクセル マクロ VBA 罫線 文字列

    職場で使う表をVBAマクロを用いて罫線作成をしています。 前任者のアレンジを頼まれたのですが前任者に連絡が取れず困っています。 表の特徴は以下のようになります。 ・A列を飛ばし、B列から2列飛びで文字を記入 ・b2=曜日、b3=1、b4=2、b5=3、b6=4、b7=空白のセットが曜日ごとに2セット×7日分 この表を ・b2=曜日、b3=-3、b4=-2、b5=-1、b6=0、b7=1、b8=2、b9=3、b10=4、b11=空白のセットが曜日ごとに2セット×7日分 に変更したいのですが空欄の場所がずれてしまい上手くいきません。 原本のマクロは以下です。 ---------------------------------------------------------------- Sub 罫線作成() Range(Cells(4, 1), Cells(86, 22)).Select Selection.Borders(xlDiagonalDown).LineStyle = xlNone Selection.Borders(xlDiagonalUp).LineStyle = xlNone Selection.Borders(xlEdgeLeft).LineStyle = xlNone Selection.Borders(xlEdgeTop).LineStyle = xlNone Selection.Borders(xlEdgeBottom).LineStyle = xlNone Selection.Borders(xlEdgeRight).LineStyle = xlNone Selection.Borders(xlInsideVertical).LineStyle = xlNone Selection.Borders(xlInsideHorizontal).LineStyle = xlNone ch1 = "月火水木金土日" For i = 4 To 76 Step 12 n1 = (i + 8) \ 12 Range(Cells(i, 1), Cells(i + 10, 22)).Select With Selection.Borders(xlEdgeLeft) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeBottom) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeRight) .LineStyle = xlContinuous .Weight = xlMedium .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideVertical) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlInsideHorizontal) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With 'Cells(i, 1) = Mid(ch1, n1, 1) For i2 = 2 To 20 Step 3 For i3 = i To i + 10 nb1 = (i3 + 8) Mod 12 If nb1 = 0 Or nb1 = 6 Then Cells(i3, i2) = Mid(ch1, n1, 1) If nb1 = 1 Or nb1 = 7 Then Cells(i3, i2) = 1 If nb1 = 2 Or nb1 = 8 Then Cells(i3, i2) = 2 If nb1 = 3 Or nb1 = 9 Then Cells(i3, i2) = 3 If nb1 = 4 Or nb1 = 10 Then Cells(i3, i2) = 4 Next Next Next End Sub ---------------------------------------------------------------- 4行目から142行目まで使用することは分かっているのですが… どうかご助力お願いします。

  • VBA 「文字が入っていたら、上下に線を引く」

    困っています。どなたか教えてください。 下記のように作成しましたが、 A列に文字が入っていたら、上下に線を引くというプロシージャにしたいと思っています。 If Cells(c, 4) = "" Then Range(Cells(c, 1), Cells(c, 6)).Select With Selection.Borders(xlEdgeBottom) .LineStyle = xlDot .Weight = xlThin .ColorIndex = xlAutomatic End With With Selection.Borders(xlEdgeTop) .LineStyle = xlContinuous .Weight = xlThin .ColorIndex = xlAutomatic End With bolFlg = True Else まだまだ続きますが・・・・。 よろしくお願いいたします。

  • VBA罫線

    VBA罫線 a = 9 With Range(Cells(3, 2), Cells(a, 5)) .Borders(xlEdgeTop).LineStyle = xlContinuous .Borders(xlEdgeBottom).LineStyle = xlContinuous .Borders(xlEdgeRight).LineStyle = xlContinuous .Borders(xlEdgeLeft).LineStyle = xlContinuous .Borders(xlInsideVertical).LineStyle = xlContinuous .Borders(xlInsideHorizontal).LineStyle = xlContinuous End With どこのワークシートかを指定する場合はどうしたらいいのでしょうか?

  • EXCEL VBA 早く処理をする

    よろしくお願いします 下の構文を標準モジュールに書き込み、callで実行しているのですが 処理に時間がかかります。 処理を早くする方法と構文の簡素化のご教示をお願いします。 Application.ScreenUpdating = False For i = 1 To 12 With Worksheets(i) .Select LastRow = .Range("A150").End(xlUp).Row + 1 .Range("A8:G" & LastRow).Sort Key1:=Range("A8"), order1:=xlAscending .Range("G8:G" & LastRow - 1).Formula = "=G7+E8-F8" LastRow = .Range("A150").End(xlUp).Row + 1 .Range("A" & LastRow).Select Dim EndRow As Long EndRow = .Range("A" & Rows.Count).End(xlUp).Row Cells(Rows.Count, 1).End(xlUp).Offset(1, 3) = .Name & "合計" Cells(Rows.Count, 1).End(xlUp).Offset(1, 4) = Application.WorksheetFunction.Sum(Range("E7:E" & EndRow)) Cells(Rows.Count, 1).End(xlUp).Offset(1, 5) = Application.WorksheetFunction.Sum(Range("F7:F" & EndRow)) Cells(Rows.Count, 1).End(xlUp).Offset(2, 3) = "前月繰越" Cells(Rows.Count, 1).End(xlUp).Offset(2, 4) = .Range("G7") Cells(Rows.Count, 1).End(xlUp).Offset(2, 5) = "" Cells(Rows.Count, 1).End(xlUp).Offset(3, 4) = "" Cells(Rows.Count, 1).End(xlUp).Offset(3, 3) = "次月繰越" Cells(Rows.Count, 1).End(xlUp).Offset(4, 3) = "合計" Cells(Rows.Count, 1).End(xlUp).Offset(3, 5) = Cells(Rows.Count, 1).End(xlUp).Offset(2, 4) + Cells(Rows.Count, 1).End(xlUp).Offset(1, 4) - Cells(Rows.Count, 1).End(xlUp).Offset(1, 5) Cells(Rows.Count, 1).End(xlUp).Offset(4, 4) = Cells(Rows.Count, 1).End(xlUp).Offset(2, 4) + Cells(Rows.Count, 1).End(xlUp).Offset(1, 4) Cells(Rows.Count, 1).End(xlUp).Offset(4, 5) = Cells(Rows.Count, 1).End(xlUp).Offset(3, 5) + Cells(Rows.Count, 1).End(xlUp).Offset(1, 5) Cells(Rows.Count, 1).End(xlUp).Offset(1, 6) = "" Cells(Rows.Count, 1).End(xlUp).Offset(2, 6) = "" Cells(Rows.Count, 1).End(xlUp).Offset(3, 6) = "" Cells(Rows.Count, 1).End(xlUp).Offset(4, 6) = Cells(Rows.Count, 1).End(xlUp).Offset(0, 6) .Range("C7").End(xlDown).Select Selection.Offset(4, 2).Borders(xlEdgeTop).Weight = xlHairline Selection.Offset(4, 2).Borders(xlEdgeBottom).LineStyle = xlDouble Selection.Offset(4, 3).Borders(xlEdgeTop).Weight = xlHairline Selection.Offset(4, 3).Borders(xlEdgeBottom).LineStyle = xlDouble Selection.Offset(4, 4).Borders(xlEdgeTop).Weight = xlHairline Selection.Offset(4, 4).Borders(xlEdgeBottom).LineStyle = xlDouble Selection.Offset(0, 2).Borders(xlEdgeTop).Weight = xlHairline Selection.Offset(0, 2).Borders(xlEdgeBottom).LineStyle = xlContinuous Selection.Offset(0, 2).Borders(xlEdgeBottom).Weight = xlThin Selection.Offset(0, 3).Borders(xlEdgeTop).Weight = xlHairline Selection.Offset(0, 3).Borders(xlEdgeBottom).LineStyle = xlContinuous Selection.Offset(0, 3).Borders(xlEdgeBottom).Weight = xlThin Selection.Offset(0, 4).Borders(xlEdgeTop).Weight = xlHairline Selection.Offset(0, 4).Borders(xlEdgeBottom).LineStyle = xlContinuous Selection.Offset(0, 4).Borders(xlEdgeBottom).Weight = xlThin End With Next i Application.ScreenUpdating = True

  • エクセル2010でマクロが動きません

    こんにちは。 マクロ超初心者です。 頑張ってエクセル2016でマクロ作成しましたが、エクセル2010で途中から動かず…。 何が悪いんでしょうか… ここから動きません…と書いたところから動きません(涙) Private Sub シート編集_Click() Application.ScreenUpdating = False Dim i Dim Sh1 As Worksheet Dim Sh2 As Worksheet Dim Sh4 As Worksheet Set Sh1 = Worksheets("あ") Set Sh2 = Worksheets("い") Set Sh4 = Worksheets("う") Dim dayCutoff As Date dayCutoff = Application.InputBox("年月日を入力してください", "お支払期限 年月日を入力", Format(Date, "yyyy/mm/dd")) Sh4.Range("D12").Value = DateSerial(Year(dayCutoff), Month(dayCutoff) + 2, 0) 'お支払期限 dayCutoff = Application.InputBox("年月日を入力してください", "請求書発行 日を入力", Format(Date, "yyyy/mm/dd")) Sh4.Range("AC3").Value = Format(Date, "yyyy/mm/dd") '発行日 Sh1.Cells.Clear With Sh1 'edit .Range("A2") = "番号" .Range("B2") = "会社名" .Range("C2") = "判定" .Range("D2") = "契約番号" .Range("E2") = "拠点" .Range("F2") = "税率" .Range("G2") = "月額(税抜)" .Range("H2") = "消費税" .Range("I2") = "月額(税込)" .Range("J2") = "今回" .Range("K2") = "全回" .Range("L2") = "店番" ここから動きません………… For i = 3 To Sh2.Cells(.Rows.Count, 1).End(xlUp).Row .Cells(i, 1) = Sh2.Cells(i, 2) .Cells(i, 2) = Sh2.Cells(i, 4) .Cells(i, 4) = Sh2.Cells(i, 3) .Cells(i, 5) = Sh2.Cells(i, 4) & "(" & Sh2.Cells(i, 6) & ")" .Cells(i, 6) = Sh2.Cells(i, 9) & "%課税" .Cells(i, 7) = Sh2.Cells(i, 8) .Cells(i, 8) = Sh2.Cells(i, 10) .Cells(i, 9) = Sh2.Cells(i, 11) .Cells(i, 10) = Sh2.Cells(i, 12) .Cells(i, 11) = Sh2.Cells(i, 7) .Cells(i, 12) = Sh2.Cells(i, 2) If Sh1.Cells(i, 10) > Sh1.Cells(i, 11) Then .Cells(i, 3) = "×" Else .Cells(i, 3) = "〇" End If If Sh1.Cells(i, 3) = "×" Then .Cells(i, 2) = "" End If Next i End With '空白行を削除 Dim j As Integer, myFlag As Boolean Dim c As Range With Worksheets("edit").Range("A2").CurrentRegion For j = .Rows.Count To 2 Step -1 myFlag = False For Each c In .Cells(j, 2) If c.Value <> "" Then myFlag = True Exit For End If Next If myFlag = False Then .Rows(j).Delete End If Next End With MsgBox "データの転記が終わりました" End Sub

  • VBA  エラー

    Sub 上下カット1() Dim MyR As Range, MyMax As Integer, MyMin As Integer Dim MX As Range, MN As Range With ActiveSheet MyMax = WorksheetFunction.Max(.Range("D15:P15")) MyMin = WorksheetFunction.Min(.Range("D15:P15")) For Each MyR In .Range("D15:P15") If MyR.Value = MyMax Then Set MX = MyR If MyR.Value = MyMin Then Set MN = MyR Next MX.Borders(xlDiagonalUp).LineStyle = xlContinuous MN.Borders(xlDiagonalUp).LineStyle = xlContinuous End With With ActiveSheet MyMax = WorksheetFunction.Max(.Range("D16:P16")) MyMin = WorksheetFunction.Min(.Range("D16:P16")) For Each MyR In .Range("D16:P16") If MyR.Value = MyMax Then Set MX = MyR If MyR.Value = MyMin Then Set MN = MyR Next MX.Borders(xlDiagonalUp).LineStyle = xlContinuous MN.Borders(xlDiagonalUp).LineStyle = xlContinuous End With End Sub を実行すると、 MX.Borders(xlDiagonalUp).LineStyle = xlContinuous の部分にエラーがでます。 対処方法を教えてください。

  • マクロで質問します。

    初心者です。 下記のようなマクロの式があるのですが、条件を一つ増やしたいのですが、 イロイロ試してみたのですが、うまくゆきませんので教えてください! Sub 給与支払一覧() Application.ScreenUpdating = False Dim Sh As Worksheet For Each Sh In Worksheets If Sh.Name <> "給与支払一覧" And Sh.Name Like "Sheet*" Then With Worksheets("給与支払一覧") If Sh.Range("D14").Value > 0 Then With .Cells(.Rows.Count, 1).End(xlUp).Offset(1) Sh.Range("O2:X14").Copy .Cells(1) .Resize(13, 10).Value = Sh.Range("O2:X14").Value End With End If End With End If Next Sh Set Sh = Nothing End Sub この中で If Sh.Range("D14").Value > 0 Then とありますが、 同じ条件で I14も 0より大きいな時としたいのですが、 うまくゆきませんでした。 たぶん基本できな簡単な事と思いますが 分かりません。 If Sh.Range("D14").Value > 0 Then If Sh.Range("I14").Value > 0 Then 並べてみたり If Sh.Range("D14、I14").Value > 0 Then こんなのや If Sh.Range("D14、I14").).Value > 0 Then このような事も 他にも笑われるようなことも・・・・・ よろしくお願いします。

  • VBA エラー

    Sub 上下カット1() Dim MyR As Range, MyMax As Integer, MyMin As Integer Dim MX As Range, MN As Range With ActiveSheet MyMax = WorksheetFunction.Max(.Range("D15:P15")) MyMin = WorksheetFunction.Min(.Range("D15:P15")) For Each MyR In .Range("D15:P15") If MyR.Value = MyMax Then Set MX = MyR If MyR.Value = MyMin Then Set MN = MyR Next MX.Borders(xlDiagonalUp).LineStyle = xlContinuous MN.Borders(xlDiagonalUp).LineStyle = xlContinuous End With With ActiveSheet MyMax = WorksheetFunction.Max(.Range("D16:P16")) MyMin = WorksheetFunction.Min(.Range("D16:P16")) For Each MyR In .Range("D16:P16") If MyR.Value = MyMax Then Set MX = MyR If MyR.Value = MyMin Then Set MN = MyR Next MX.Borders(xlDiagonalUp).LineStyle = xlContinuous MN.Borders(xlDiagonalUp).LineStyle = xlContinuous End With End Sub を実行すると”オブジェクト変数またはWithブロック変数が設定されていません。”と出ます。 どうしたらいいですか?

  • エクセル:シートを切り替えずに別シート上の操作をする

    タイトルが正しいかどうか疑問ですが。 シート[Sheet1]にて値を入力したアドレス(の行番号と列番号)を取得し、 その周囲のセルの罫線の色を赤(3)から灰色(15)に置換するコードを作っています。 Sheet1のコードには、 Private Sub Worksheet_Change(ByVal Target As Range)  AAA Target End Sub とだけ書き、入力があったらプロシージャAAAへTargetを持って飛びます。 Sub AAA(ByVal Target As Range)  Dim M_Row As Integer  Dim M_Clm As Integer  Dim Y As Range  M_Row = Target.Row  M_Clm = Target.Column  For Each Y In Worksheets("Sheet1").Range(Cells(M_Row - 2, M_Clm), Cells(M_Row + 1, M_Clm + 5))   With Y    If .Borders(xlEdgeTop).ColorIndex = 3 Then .Borders(xlEdgeTop).ColorIndex = 15    If .Borders(xlEdgeLeft).ColorIndex = 3 Then .Borders(xlEdgeLeft).ColorIndex = 15    If .Borders(xlEdgeBottom).ColorIndex = 3 Then .Borders(xlEdgeBottom).ColorIndex = 15   End With  Next End Sub ここまでは正常に動きます。 この後に、アクティブでないシート[Sheet2]の同じセル範囲にある罫線の色も同じように置換したいので、 上記コードに続けて、以下のように書きました。 Sub AAA(ByVal Target As Range)  Dim M_Row As Integer  Dim M_Clm As Integer  Dim Y As Range  M_Row = Target.Row  M_Clm = Target.Column  For Each Y In Worksheets("Sheet1").Range(Cells(M_Row - 2, M_Clm), Cells(M_Row + 1, M_Clm + 5))   With Y    If .Borders(xlEdgeTop).ColorIndex = 3 Then .Borders(xlEdgeTop).ColorIndex = 15    If .Borders(xlEdgeLeft).ColorIndex = 3 Then .Borders(xlEdgeLeft).ColorIndex = 15    If .Borders(xlEdgeBottom).ColorIndex = 3 Then .Borders(xlEdgeBottom).ColorIndex = 15   End With  Next  For Each Y In Worksheets("Sheet2").Range(Cells(M_Row - 2, M_Clm), Cells(M_Row + 1, M_Clm + 5))   With Y    If .Borders(xlEdgeTop).ColorIndex = 3 Then .Borders(xlEdgeTop).ColorIndex = 15    If .Borders(xlEdgeLeft).ColorIndex = 3 Then .Borders(xlEdgeLeft).ColorIndex = 15    If .Borders(xlEdgeBottom).ColorIndex = 3 Then .Borders(xlEdgeBottom).ColorIndex = 15   End With  Next End Sub これだと、  For Each Y In Worksheets("Sheet2").Range(Cells(M_Row - 2, M_Clm), Cells(M_Row + 1, M_Clm + 5)) の部分で失敗します。 この1行前に、  Sheets("Sheet2").Select と入れてやると正常に動作するのですが、 シートを切り替えずにやりたいと思っています。 可能でしょうか? 以下のように、 実行後にSheet1に戻し、 それらを Application.ScreenUpdating = False Application.ScreenUpdating = True で挟むことで、見た目はシートを切り替えずに実行できるのですが、 実際にこのコードを組み込んでいるシートはシート上にあるデータが多いためか(600行×100列程度)、 全く同じコードを実行しても一瞬画面がチラついてしまいます。 (新規Bookで同じコードを組み込んで、何行かに罫線を引いただけのシートだと全くチラつかなかったので、 シート上のデータが多いせいじゃないかと思いました) Sub AAA(ByVal Target As Range)  Dim M_Row As Integer  Dim M_Clm As Integer  Dim Y As Range  M_Row = Target.Row  M_Clm = Target.Column  For Each Y In Worksheets("Sheet1").Range(Cells(M_Row - 2, M_Clm), Cells(M_Row + 1, M_Clm + 5))   With Y    If .Borders(xlEdgeTop).ColorIndex = 3 Then .Borders(xlEdgeTop).ColorIndex = 15    If .Borders(xlEdgeLeft).ColorIndex = 3 Then .Borders(xlEdgeLeft).ColorIndex = 15    If .Borders(xlEdgeBottom).ColorIndex = 3 Then .Borders(xlEdgeBottom).ColorIndex = 15   End With  Next  Application.ScreenUpdating = False  Sheets("Sheet2").Select  For Each Y In Worksheets("Sheet2").Range(Cells(M_Row - 2, M_Clm), Cells(M_Row + 1, M_Clm + 5))   With Y    If .Borders(xlEdgeTop).ColorIndex = 3 Then .Borders(xlEdgeTop).ColorIndex = 15    If .Borders(xlEdgeLeft).ColorIndex = 3 Then .Borders(xlEdgeLeft).ColorIndex = 15    If .Borders(xlEdgeBottom).ColorIndex = 3 Then .Borders(xlEdgeBottom).ColorIndex = 15   End With  Next  Sheets("Sheet1").Select  Application.ScreenUpdating = True End Sub よろしくお願いします。

専門家に質問してみよう