엑셀 차트 강의 #2-2 - 4강
엑셀 지도 차트 만들기, 오류 없이 쉽고 빠르게 만드는 방법
중앙재난안전대책본부에서 제공하는 원본 데이터를 참고하여 코로나 실시간 발생현황 지도 차트 제작 방법을 단계별로 알아봅니다.
📑 연결된 이미지 생성하는 매크로
Sub CreateLinkedImage()
Dim rng As Range
Dim ws As Worksheet
Dim sFormula As String
Dim pic As Shape
Application.ScreenUpdating = False
Application.Calculation = xlCalculationManual
Set ws = ActiveSheet
Set rng = ws.Range("B2").CurrentRegion '<- 연결된 이미지를 생성할 데이터가 시작되는 셀 주소를 입력하세요
With ws
For i = rng.Column To rng.Column + rng.Columns.Count - 1
.Range(.Cells(rng.Row, i), .Cells(rng.Row + rng.Rows.Count - 1, i)).Copy
.Cells(rng.Row + rng.Rows.Count + 1, i).Select
.Pictures.Paste link:=True
Next
For Each pic In ws.Shapes
sFormula = pic.DrawingObject.Formula
.Pictures(pic.Name).Formula = "='" & ws.Name & "'!" & Trim(sFormula)
Next
End With
Application.Calculation = xlCalculationAutomatic
Application.ScreenUpdating = True
End Sub