質問: 18 グラフ1(折れ線グラフ) 数式多数 使用 (他のブックへの参照と他のブックからの参照多々あり)
回答: 他人の書いたコードは読みにくいので、自分流に直してしまいました^^; やりたいことはこういうことかな? 動作確認はしてません。意を汲み取っていただけると幸いです。 ``` Sub SHC() Dim wbOld As Workbook Dim wbNew As Workbook Dim ws As Worksheet Dim rngTarget As Range Set wbOld = Workbooks("Book2") Set wbNew = Workbooks("Book1") For Each ws In wbOld.Worksheets Set rngTarget = Get_CellJoin(ws, wbNew.Sheets(ws.Index)) rngTarget.Interior.Color = ws.Range(rngTarget.Areas(1).Address).Interior.Color Next End Sub '結合セルの取得 Function Get_CellJoin(wsFrom As Worksheet, wsTo As Worksheet) As Range Dim c As Range Dim rng As Range For Each c In wsFrom.UsedRange If c.MergeCells Then If c.Address = c(1).Address Then wsTo.Range(c.MergeArea.Address).Merge If rng Is Nothing Then Set rng = c Else Set rng = Union(rng, c) End If End If End If Next Set Get_CellJoin = rng End Function ```