메인 컨텐츠로 가기

Excel에서 셀에 맞게 그림 크기를 조정하는 방법은 무엇입니까?

일반적으로 삽입 된 그림은 셀 위에 떠 있으며 대부분의 경우 하나의 그림이 많은 셀을 덮습니다. 워크 시트에 그림이 많은 경우 각 그림을 단일 셀에 넣을 수 있습니다. 하지만 어떻게 처리할까요? 실제로 셀 크기에 맞게 그림의 크기를 빠르게 조정하는 데 도움이되는 몇 가지 까다로운 방법이 있습니다.

VB 매크로를 사용하여 단일 셀에 맞게 선택한 그림 크기 조정

Excel 용 Kutools를 사용하여 삽입 된 그림의 크기를 셀에 맞게 조정하십시오.


화살표 블루 오른쪽 거품 VB 매크로를 사용하여 단일 셀에 맞게 선택한 그림 크기 조정

VB 매크로를 적용하여 선택한 그림의 크기를 단일 셀에 맞출 수 있지만 수동으로 그림의 너비와 높이를 조정할 수는 없습니다. 다음 단계로 수행 할 수 있습니다.

1 단계 : 워크 시트에 그림을 삽입하고 단일 셀에 맞게 크기를 조정할 그림을 선택합니다.

문서-크기 조정-그림-크기-셀1

2 단계 : ALT + F11 키가 열립니다. 응용 프로그램 용 Microsoft Visual Basic 창.

3 단계 : 클릭 끼워 넣다 > 모듈을 클릭하고 모듈 창에 다음 매크로를 붙여 넣습니다.

VBA : 셀에 맞게 선택한 그림의 크기를 조정합니다.

Public Sub FitPic()
On Error GoTo NOT_SHAPE
Dim PicWtoHRatio As Single
Dim CellWtoHRatio As Single
With Selection
PicWtoHRatio = .Width / .Height
End With
With Selection.TopLeftCell
CellWtoHRatio = .Width / .RowHeight
End With
Select Case PicWtoHRatio / CellWtoHRatio
Case Is > 1
With Selection
.Width = .TopLeftCell.Width
.Height = .Width / PicWtoHRatio
End With
Case Else
With Selection
.Height = .TopLeftCell.RowHeight
.Width = .Height * PicWtoHRatio
End With
End Select
With Selection
.Top = .TopLeftCell.Top
.Left = .TopLeftCell.Left
End With
Exit Sub
NOT_SHAPE:
MsgBox "Select a picture before running this macro."
End Sub

4 단계 : F5 이 매크로를 실행하려면 키를 누르십시오.

5 단계 : 위의 단계를 반복하여 다른 그림의 크기를 단일 셀에 맞 춥니 다.

이제 삽입 된 모든 그림의 크기가 조정되고 셀에 맞습니다. 다음 스크린 샷을 참조하십시오.

문서-크기 조정-그림-크기-셀2

주의 사항: 한 번에 하나의 사진 만 크기를 조정할 수 있습니다. 한 번 이상의 사진을 선택하면 경고 대화 상자가 나타납니다.


화살표 블루 오른쪽 거품 Excel 용 Kutools를 사용하여 삽입 된 그림의 크기를 셀에 맞게 조정하십시오.

당신이 있으면 Excel 용 Kutools 설치되어 있으면 적용 할 수 있습니다. 사진 가져 오기 그림을 삽입하는 동안 셀 또는 고정 높이에 맞게 모든 그림의 크기를 조정하는 도구입니다.

Excel 용 Kutools 300 개 이상의 편리한 Excel 도구가 포함되어 있습니다. 30 일 동안 제한없이 무료로 사용해보세요. 그것을 지금.

1 단계 : 그림을 삽입 할 범위 셀을 선택하고 Enterprise >가져 오기 / 내보내기 > 사진 가져 오기. 다음 스크린 샷을 참조하십시오.

doc-resize-picture-to-fit-cell-1

2 단계 : 사진 가져 오기 대화 상자에서 드롭 다운 목록에서 삽입 순서를 선택하고 추가 버튼을 눌러 파일 또는 폴더에서 필요한 사진을 추가 한 다음 크기 단추. 스크린 샷보기 :

doc-resize-picture-to-fit-cell-2

3 단계 : 확인 셀 크기 일치 선택권. 그런 다음 Ok > 수입 대화 상자를 닫습니다. 스크린 샷보기 :

doc-resize-picture-to-fit-cell-3

이제 그림이 셀에 맞게 삽입 된 것을 볼 수 있습니다.

doc-resize-picture-to-fit-cell-4

주의 사항: 3 단계에서 셀 높이와 너비를 지정하여 그림의 크기를 조정할 수도 있습니다.

이것에 대해 더 알고 싶다면 그림 가져 오기 기능, 방문하십시오 여기를 눌러 더 많은 정보를 찾으세요..


관련 기사:

Excel에서 여러 셀의 크기를 조정하여 그 위에 그림을 빠르게 맞추는 방법은 무엇입니까?

최고의 사무 생산성 도구

🤖 Kutools AI 보좌관: 다음을 기반으로 데이터 분석을 혁신합니다. 지능형 실행   |  코드 생성  |  사용자 정의 수식 만들기  |  데이터 분석 및 차트 생성  |  Kutools 기능 호출...
인기 기능: 중복 항목 찾기, 강조 표시 또는 식별   |  빈 행 삭제   |  데이터 손실 없이 열이나 셀 결합   |   수식없이 반올림 ...
슈퍼 조회: 다중 기준 VLookup    다중 값 VLookup  |   여러 시트에 걸친 VLookup   |   퍼지 조회 ....
고급 드롭다운 목록: 드롭다운 목록을 빠르게 생성   |  종속 드롭다운 목록   |  다중 선택 드롭 다운 목록 ....
열 관리자: 특정 개수의 열 추가  |  열 이동  |  Toggle 숨겨진 열의 가시성 상태  |  범위 및 열 비교 ...
특색 지어진 특징: 그리드 포커스   |  디자인보기   |   큰 수식 바    통합 문서 및 시트 관리자   |  리소스 라이브러리 (자동 텍스트)   |  날짜 선택기   |  워크 시트 결합   |  셀 암호화/해독    목록으로 이메일 보내기   |  슈퍼 필터   |   특수 필터 (굵게/기울임꼴/취소선 필터링...) ...
상위 15개 도구 세트12 본문 도구 (텍스트 추가, 문자 제거,...)   |   50+ 거래차트 유형 (Gantt 차트,...)   |   40+ 실용 방식 (생일을 기준으로 나이 계산,...)   |   19 삽입 도구 (QR 코드 삽입, 경로에서 그림 삽입,...)   |   12 매출 상승 도구 (숫자를 단어로, 환율,...)   |   7 병합 및 분할 도구 (고급 결합 행, 셀 분할,...)   |   ... 그리고 더

Excel용 Kutools로 Excel 기술을 강화하고 이전과는 전혀 다른 효율성을 경험해 보세요. Excel용 Kutools는 생산성을 높이고 시간을 절약하기 위해 300개 이상의 고급 기능을 제공합니다.  가장 필요한 기능을 얻으려면 여기를 클릭하십시오...

상품 설명


Office Tab은 Office에 탭 인터페이스를 제공하여 작업을 훨씬 쉽게 만듭니다.

  • Word, Excel, PowerPoint에서 탭 편집 및 읽기 사용, Publisher, Access, Visio 및 Project.
  • 새 창이 아닌 동일한 창의 새 탭에서 여러 문서를 열고 만듭니다.
  • 생산성을 50% 높이고 매일 수백 번의 마우스 클릭을 줄입니다!
Comments (15)
No ratings yet. Be the first to rate!
This comment was minimized by the moderator on the site
La macro posiziona l'immagine "Immagine 2" al centro della cella ("D5"), anche se questa è unita ad altre celle. Spero possa esservi utile

Sub ImpFoto()
Dim hcell As Single ' altezza cella
Dim Lcell As Single ' larghezza cella
Dim hfoto As Single ' altezza foto
Dim Lfoto As Single ' larghezza foto
Dim Rfoto As Single ' rapporto foto h/L

Range("D5").Select

hcell = Selection.Height
Lcell = Selection.Width
hfoto = ActiveSheet.Shapes("Immagine 2").Height
Lfoto = ActiveSheet.Shapes("Immagine 2").Width
Rfoto = hfoto / Lfoto

If hfoto < Lfoto Then
Lfoto = Lcell - 10
hfoto = Lfoto * Rfoto

If hfoto > hcell Then
hfoto = hcell - 3
Lfoto = hfoto / Rfoto
End If

ActiveSheet.Shapes("Immagine 2").Height = hfoto
ActiveSheet.Shapes("Immagine 2").Width = Lfoto
Else
hfoto = hcell - 10
Lfoto = hfoto / Rfoto
ActiveSheet.Shapes("Immagine 2").Height = hfoto
ActiveSheet.Shapes("Immagine 2").Width = Lfoto
End If

Range("D5").Select

With ActiveSheet.Shapes("Immagine 2")
.Top = Selection.Top + (Selection.Height - .Height) / 2
.Left = Selection.Left + (Selection.Width - .Width) / 2
End With
End Sub
This comment was minimized by the moderator on the site
Thank you, it really works!
This comment was minimized by the moderator on the site
Hi, Need this code disabling the lock aspect ratio
This comment was minimized by the moderator on the site
Hi..
perfact solution. But i want that function to work with command button. i need to make a command button to insert and auto resize to cell size. please help.
This comment was minimized by the moderator on the site
Brilliant! Works great! Just what I was looking for! Thank you!
This comment was minimized by the moderator on the site
it works if the cells are not merged. unfortunately, I merged some cells and it fits only in the upper left cell which makes the photo very tiny.
This comment was minimized by the moderator on the site
Hi, I really love this macro that makes images fit cells, it really helped me with some work stuff. But does anyone know how to write this code for applescript? I have to use macs and the apple version of excel, Numbers, only uses applescript. Help! Many thanks, Harry
This comment was minimized by the moderator on the site
Thanks it did work but I have about 500 pictures so I don't want to do them one at a time - how do I do them all at the same time please?
This comment was minimized by the moderator on the site
Works!! But i have one question, i want to fit a img in a range of cells merged, how can i do it?
This comment was minimized by the moderator on the site
Public Sub FitPic()
'https://www.extendoffice.com/documents/excel/1060-excel-resize-picture-to-fit-cell.html
'Slight modification to resize into merged cells
On Error GoTo NOT_SHAPE
Dim PicWtoHRatio As Single
Dim CellWtoHRatio As Single
With Selection
PicWtoHRatio = .Width / .Height
End With
With Selection.TopLeftCell
CellWtoHRatio = .MergeArea.Width / .MergeArea.Height
End With
Select Case PicWtoHRatio / CellWtoHRatio
Case Is > 1
With Selection
.Width = .TopLeftCell.MergeArea.Width
.Height = .Width / PicWtoHRatio
End With
Case Else
With Selection
.Height = .TopLeftCell.MergeArea.Height
.Width = .Height * PicWtoHRatio
End With
End Select
With Selection
.Top = .TopLeftCell.MergeArea.Top
.Left = .TopLeftCell.MergeArea.Left
.Placement = xlMoveAndSize
End With
Exit Sub
NOT_SHAPE:
MsgBox "Select a picture before running this macro."
End Sub
This comment was minimized by the moderator on the site
[quote]Works!! But i have one question, i want to fit a img in a range of cells merged, how can i do it?By Marcelo[/quote] Marcelo did you get the updated marco for the merged cell? I am trying to do the same thing. thanks
This comment was minimized by the moderator on the site
I tried this macro last night and it adjust only the height. The width it doesn't incorrectly. Any Help please?
This comment was minimized by the moderator on the site
Thank you this was perfect!!
There are no comments posted here yet
Load More
Please leave your comments in English
Posting as Guest
×
Rate this post:
0   Characters
Suggested Locations