Excel VBA質問箱 IV

当質問箱は、有志のボランティア精神のおかげで成り立っています。
問題が解決したら、必ずお礼をしましょうね。
本サイトの基本方針をまとめました。こちら をご一読ください。

投稿種別の選択が必要です。ご注意ください。
迷惑投稿防止のため、URLの入力を制限しています。ご了承ください。


58527 / 76738 ←次へ | 前へ→

【22937】書式設定をくりかえし
質問  よへです  - 05/3/8(火) 8:52 -

引用なし
パスワード
   こんにちは。
初心者ですがお願いします
どなたか教えてください
条件付書式設定の内容を変更したくてマクロを書いていましたが、
あまりにも長すぎて困っていますたすけてください。

セル一個を参照し1があれば色塗りで
色塗りセルは、縦に13回横に70回ほどあります
参照セルは、縦に30回横に13回です

Sub Macro2()
  Range("C106").Select   <--------色塗りセル
  Selection.FormatConditions.Delete                   
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DB$4=1" <-参照セル
  Selection.FormatConditions(1).Interior.ColorIndex = 38 <--色です       
  Range("C105").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DB$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C104").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DC$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C103").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DC$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C102").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DD$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C101").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DD$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C100").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DE$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C99").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DE$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C98").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DF$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C97").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DF$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C96").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DG$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C95").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DG$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C94").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DH$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C93").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DH$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C92").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DI$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C91").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DI$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C90").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DJ$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C89").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DJ$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C88").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DK$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C87").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DK$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C86").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DL$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C85").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DL$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C84").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DM$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C83").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DM$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C82").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DN$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("C81").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DN$4=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("D106").Select       <--ここから2行目のセルに対して処理をしています。
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DB$5=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("D105").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DB$5=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("D104").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DC$5=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("D103").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DC$5=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38
  Range("D102").Select
  Selection.FormatConditions.Delete
  Selection.FormatConditions.Add Type:=xlExpression, Formula1:="=$DD$5=1"
  Selection.FormatConditions(1).Interior.ColorIndex = 38 
  
End Sub
0 hits

【22937】書式設定をくりかえし よへです 05/3/8(火) 8:52 質問
【22945】Re:書式設定をくりかえし IROC 05/3/8(火) 13:58 回答
【22949】Re:書式設定をくりかえし kazu 05/3/8(火) 15:24 発言
【22988】Re:書式設定をくりかえし よへです 05/3/9(水) 15:11 質問
【22989】Re:書式設定をくりかえし よへです 05/3/9(水) 15:26 お礼

58527 / 76738 ←次へ | 前へ→
ページ:  ┃  記事番号:
2610219
(SS)C-BOARD v3.8 is Free