오빠두엑셀 `2026 무료 챌린지` 오픈! 완주하고 수료증 받아가세요! 5년 연속 IT분야 베스트셀러! 「 진짜쓰는 실무엑셀 」로 2026년 공부 끝내기 엑셀이 막히셨나요? Q&A 게시판에서 바로 해결하세요.
메뉴

코로나 발생현황 대시보드 만들기

라이브정보
방송일 2020년 08월 01일 (7회)
조회수 1,919회
강의시간 1시간 12분
보충자료

📑 연결된 이미지 생성하는 매크로

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
스크랩 완료