{"id":12719,"date":"2025-11-04T16:26:11","date_gmt":"2025-11-04T07:26:11","guid":{"rendered":"https:\/\/manual-corp.rootip-enterprise.net\/?p=12719"},"modified":"2025-11-04T17:06:24","modified_gmt":"2025-11-04T08:06:24","slug":"%e7%95%b0%e3%81%aa%e3%82%8b%e3%82%b5%e3%82%a4%e3%82%ba%e3%81%ae%e7%94%bb%e5%83%8f%e3%83%87%e3%83%bc%e3%82%bf%e3%82%92excel%e3%83%9e%e3%82%af%e3%83%ad%e3%81%a7%e7%b5%b1%e4%b8%80%e3%81%99%e3%82%8b","status":"publish","type":"post","link":"https:\/\/manual-corp.rootip-enterprise.net\/?p=12719","title":{"rendered":"\u7570\u306a\u308b\u30b5\u30a4\u30ba\u306e\u753b\u50cf\u30c7\u30fc\u30bf\u3092Excel\u30de\u30af\u30ed\u3067\u7d71\u4e00\u3059\u308b"},"content":{"rendered":"\n<div class=\"wp-block-vk-blocks-faq2 vk_faq  vk_faq-accordion vk_faq-accordion-close\"><div class=\"vk_faq-header\"><\/div><dl class=\"vk_faq-body\">\n<dt class=\"wp-block-vk-blocks-faq2-q vk_faq_title\" aria-label=\"\u8cea\u554f\">\n<p>rootip\u3067\u5546\u6a19\u6848\u4ef6\u3092\u691c\u7d22\u3057\u305f\u5f8c\u3001Excel\u3067\u30a8\u30af\u30b9\u30dd\u30fc\u30c8\u3059\u308b\u3068\u753b\u50cf\u30b5\u30a4\u30ba\u304c\u30d0\u30e9\u30d0\u30e9\u306b\u306a\u308a\u3001\u66f8\u5f0f\u8abf\u6574\u306b\u6642\u9593\u304c\u304b\u304b\u308a\u307e\u3059\u3002\u4f55\u304b\u826f\u3044\u65b9\u6cd5\u306f\u3042\u308a\u307e\u305b\u3093\u304b\u3002<\/p>\n<\/dt>\n\n\n\n<dd class=\"wp-block-vk-blocks-faq2-a vk_faq_content\" aria-label=\"\u56de\u7b54\">\n<p>Excel\u51fa\u529b\u5f8c\u3001<strong>VBA\uff08\u30de\u30af\u30ed\uff09<\/strong>\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u753b\u50cf\u30c7\u30fc\u30bf\u306e\u30b5\u30a4\u30ba\u3092\u4e00\u62ec\u3067\u7d71\u4e00\u3057\u3001\u7e26\u6a2a\u6bd4\u3092\u7dad\u6301\u3057\u305f\u307e\u307e\u30bb\u30eb\u5185\u306b\u53ce\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<br>\u8cb4\u793e\u5185\u306e\u30bb\u30ad\u30e5\u30ea\u30c6\u30a3\u30dd\u30ea\u30b7\u30fc\u3092\u3054\u78ba\u8a8d\u306e\u3046\u3048\u3001\u30de\u30af\u30ed\u306e\u5229\u7528\u304c\u8a31\u53ef\u3055\u308c\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u8a2d\u5b9a\u30fb\u5b9f\u884c\u3092\u304a\u8a66\u3057\u304f\u3060\u3055\u3044\u3002<br><br>\u3010\u64cd\u4f5c\u624b\u9806\u3011<br>\u2460\u8abf\u6574\u3057\u305f\u3044Excel\u30c7\u30fc\u30bf\u3092\u958b\u304d\u3001\u4ee3\u8868\u56f3\u306e\u5217\u306e\u6a2a\u5e45\u3092\u5e0c\u671b\u306e\u6a2a\u5e45\u306b\u8abf\u6574\u3057\u307e\u3059\u3002<br>\u2461<strong>\u300c\u540d\u524d\u3092\u4ed8\u3051\u3066\u4fdd\u5b58\u300d<\/strong>\u3067\u30d5\u30a1\u30a4\u30eb\u5f62\u5f0f\u3092\u3000Excel \u30de\u30af\u30ed\u6709\u52b9\u30d6\u30c3\u30af\uff08.xlsm\uff09 \u3068\u3057\u3066\u4fdd\u5b58\u3057\u307e\u3059\u3002<br>\u2462\u4fdd\u5b58\u3057\u305f\u30de\u30af\u30ed\u30d6\u30c3\u30af\u3092\u958b\u304d\u3001\uff3bAlt\uff3d\uff0b\uff3bF11\uff3d \u3092\u62bc\u3057\u3066VBA\u30a8\u30c7\u30a3\u30bf\u3092\u8d77\u52d5\u3057\u307e\u3059\u3002<br>\u2463\u30e1\u30cb\u30e5\u30fc\u30d0\u30fc\u304b\u3089\uff3b\u633f\u5165\uff3d \u2192 \uff3b\u6a19\u6e96\u30e2\u30b8\u30e5\u30fc\u30eb\uff3d \u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<br>\u2464\u4ee5\u4e0b\u306e\u30b3\u30fc\u30c9\u3092\u8cbc\u308a\u4ed8\u3051\u3001\u4e0a\u66f8\u304d\u4fdd\u5b58\u3057\u307e\u3059\u3002<br>&#8212;&#8211;\u30b3\u30b3\u30ab\u30e9&#8212;&#8212;<br>Option Explicit<br>Sub FitPicturesToCells_KeepAspect_Center_Simple()<br>Dim shp As Shape<br>Dim rngBox As Range<br>Dim boxW As Double, boxH As Double<br>Dim ow As Double, oh As Double<br>Dim scaleValue As Double<br>Dim scaleW As Double, scaleH As Double<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>On Error Resume Next\n\nFor Each shp In ActiveSheet.Shapes\n    If shp.Type = msoPicture Or shp.Type = msoLinkedPicture Then\n        Set rngBox = shp.TopLeftCell\n        boxW = rngBox.Width\n        boxH = rngBox.Height\n        ow = shp.Width\n        oh = shp.Height\n\n        If ow &lt;= 0 Or oh &lt;= 0 Or boxW &lt;= 0 Or boxH &lt;= 0 Then GoTo ContinueNext\n\n        shp.LockAspectRatio = msoTrue\n        scaleW = boxW \/ ow\n        scaleH = boxH \/ oh\n        If scaleW &lt; scaleH Then\n            scaleValue = scaleW\n        Else\n            scaleValue = scaleH\n        End If\n        If scaleValue &lt;= 0 Then GoTo ContinueNext\n\n        shp.Width = ow * scaleValue\n        shp.Height = oh * scaleValue\n        shp.Left = rngBox.Left + (boxW - shp.Width) \/ 2\n        shp.Top = rngBox.Top + (boxH - shp.Height) \/ 2\n    End If<\/code><\/pre>\n\n\n\n<p>ContinueNext:<br>Next shp<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>On Error GoTo 0\nMsgBox \"\u7e26\u6a2a\u6bd4\u3092\u7dad\u6301\u3057\u3066\u3001\u5168\u753b\u50cf\u3092\u30bb\u30eb\u5185\u4e2d\u592e\u306b\u914d\u7f6e\u3057\u307e\u3057\u305f\u3002\"<\/code><\/pre>\n\n\n\n<p>End Sub<br>&#8212;&#8211;\u30b3\u30b3\u30de\u30c7&#8212;&#8212;<br><br><br>\u2465\u5de6\u4e0a\u306e\u30a8\u30af\u30bb\u30eb\u30a2\u30a4\u30b3\u30f3\u3092\u30af\u30ea\u30c3\u30af\uff08\u307e\u305f\u306f\u30c0\u30a4\u30a2\u30ed\u30b0\u53f3\u4e0a\u306e\u300c\u00d7\u300d\u3067VBA\u30a8\u30c7\u30a3\u30bf\u3092\u9589\u3058\u308b\uff09\u3057\u3001Excel\u306b\u623b\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"667\" height=\"210\" src=\"https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-17.png\" alt=\"\" class=\"wp-image-12723\" srcset=\"https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-17.png 667w, https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-17-300x94.png 300w, https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-17-150x47.png 150w\" sizes=\"auto, (max-width: 667px) 100vw, 667px\" \/><\/figure>\n\n\n\n<p><br>\u2466\uff3bAlt\uff3d\uff0b\uff3bF8\uff3d\u3092\u30af\u30ea\u30c3\u30af\u3057\u3001 FitPicturesToCells_KeepAspect_Center_Simple \u3092\u9078\u629e\u3057\u3001\uff3b\u5b9f\u884c\uff3d \u3092\u30af\u30ea\u30c3\u30af\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<figure class=\"wp-block-image size-full\"><img loading=\"lazy\" decoding=\"async\" width=\"429\" height=\"180\" src=\"https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-18.png\" alt=\"\" class=\"wp-image-12725\" srcset=\"https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-18.png 429w, https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-18-300x126.png 300w, https:\/\/manual-corp.rootip-enterprise.net\/wp-content\/uploads\/2025\/11\/image-18-150x63.png 150w\" sizes=\"auto, (max-width: 429px) 100vw, 429px\" \/><\/figure>\n\n\n\n<p><br>\u3010\u88dc\u8db3\u3011<br>\u30fb\u672c\u30de\u30af\u30ed\u306f\u3001\u753b\u50cf\u306e\u7e26\u6a2a\u6bd4\u3092\u7dad\u6301\u3057\u306a\u304c\u3089\u3001\u753b\u50cf\u3092\u30bb\u30eb\u5185\u306b\u53ce\u3081\u3066\u4e2d\u592e\u5bc4\u305b\u3057\u307e\u3059\u3002<br>\u30fb\u7d50\u5408\u30bb\u30eb\u3092\u4f7f\u7528\u3057\u3066\u3044\u308b\u5834\u5408\u306f\u3001\u52d5\u4f5c\u304c\u60f3\u5b9a\u3068\u7570\u306a\u308b\u53ef\u80fd\u6027\u304c\u3042\u308a\u307e\u3059\u3002<br>\u30fb\u30de\u30af\u30ed\u5b9f\u884c\u524d\u306b\u3001\u30bb\u30eb\u30b5\u30a4\u30ba\u3092\u6574\u3048\u3066\u304a\u304f\u3068\u3088\u308a\u304d\u308c\u3044\u306b\u914d\u7f6e\u3055\u308c\u307e\u3059\uff08\u624b\u9806\u2460\uff09\u3002<\/p>\n\n\n\n<div class=\"wp-block-vk-blocks-alert vk_alert alert alert-warning has-alert-icon\"><div class=\"vk_alert_icon\"><div class=\"vk_alert_icon_icon\"><i class=\"fa-solid fa-triangle-exclamation\" aria-hidden=\"true\"><\/i><\/div><div class=\"vk_alert_icon_text\"><span>Warning<\/span><\/div><\/div><div class=\"vk_alert_content\">\n<p>\u30fb\u672c\u30de\u30af\u30ed\u306f\u30012025\u5e7411\u67084\u65e5\u6642\u70b9\u3067\u4f5c\u6210\u30fb\u52d5\u4f5c\u78ba\u8a8d\u3092\u884c\u3063\u305f\u3082\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p>\u30fb\u672c\u30de\u30af\u30ed\u306e\u4f7f\u7528\u306f\u5229\u7528\u8005\u81ea\u8eab\u306e\u8cac\u4efb\u306b\u304a\u3044\u3066\u884c\u3063\u3066\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<p>\u30fb\u672c\u30de\u30af\u30ed\u3092\u4f7f\u7528\u3057\u305f\u3053\u3068\u306b\u3088\u308a\u767a\u751f\u3057\u305f\u3044\u304b\u306a\u308b\u640d\u5bb3\u30fb\u4e0d\u5177\u5408\u306b\u3064\u3044\u3066\u3082\u3001\u4f5c\u6210\u8005\u306f\u4e00\u5207\u306e\u8cac\u4efb\u3092\u8ca0\u3044\u307e\u305b\u3093\u3002<\/p>\n\n\n\n<p>\u30fb\u672c\u30de\u30af\u30ed\u306f\u7279\u5b9a\u306e\u74b0\u5883\uff08Excel\u306e\u30d0\u30fc\u30b8\u30e7\u30f3\u3001\u8a2d\u5b9a\u7b49\uff09\u3067\u306e\u52d5\u4f5c\u3092\u524d\u63d0\u3068\u3057\u3066\u3044\u307e\u3059\u3002\u74b0\u5883\u306b\u3088\u3063\u3066\u306f\u6b63\u5e38\u306b\u52d5\u4f5c\u3057\u306a\u3044\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30fb\u672c\u30de\u30af\u30ed\u304a\u3088\u3073\u672c\u30de\u30cb\u30e5\u30a2\u30eb\u306e\u5185\u5bb9\u306f\u3001\u4e88\u544a\u306a\u304f\u5909\u66f4\u30fb\u524a\u9664\u3055\u308c\u308b\u5834\u5408\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p>\u30fb\u672c\u30de\u30cb\u30e5\u30a2\u30eb\u304a\u3088\u3073\u30de\u30af\u30ed\u306b\u95a2\u3059\u308b\u304a\u554f\u3044\u5408\u308f\u305b\u30fb\u30b5\u30dd\u30fc\u30c8\u306e\u63d0\u4f9b\u306f\u884c\u3063\u3066\u304a\u308a\u307e\u305b\u3093\u3002<\/p>\n<\/div><\/div>\n<\/dd>\n<\/dl><div class=\"vk_faq-footer\"><\/div><\/div>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":4,"featured_media":4888,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_coblocks_attr":"","_coblocks_dimensions":"","_coblocks_responsive_height":"","_coblocks_accordion_ie_support":"","vkexunit_cta_each_option":"","footnotes":""},"categories":[12,5],"tags":[],"class_list":["post-12719","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-12","category-5"],"_links":{"self":[{"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=\/wp\/v2\/posts\/12719","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=12719"}],"version-history":[{"count":3,"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=\/wp\/v2\/posts\/12719\/revisions"}],"predecessor-version":[{"id":12726,"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=\/wp\/v2\/posts\/12719\/revisions\/12726"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=\/wp\/v2\/media\/4888"}],"wp:attachment":[{"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=12719"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=12719"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/manual-corp.rootip-enterprise.net\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=12719"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}