{"id":295,"date":"2024-12-22T04:33:37","date_gmt":"2024-12-21T19:33:37","guid":{"rendered":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e3%83%9e%e3%82%af%e3%83%ad%e3%81%ae%e9%81%94%e4%ba%ba%e6%8a%80%ef%bc%815%e3%81%a4%e3%81%ae%e4%b8%8a%e7%b4%9a%e3%83%86%e3%82%af%e3%83%8b%e3%83%83%e3%82%af%e3%81%a7%e6%a5%ad%e5%8b%99%e5%8a%b9\/"},"modified":"2024-12-22T04:33:37","modified_gmt":"2024-12-21T19:33:37","slug":"excel%e3%83%9e%e3%82%af%e3%83%ad%e3%81%ae%e9%81%94%e4%ba%ba%e6%8a%80%ef%bc%815%e3%81%a4%e3%81%ae%e4%b8%8a%e7%b4%9a%e3%83%86%e3%82%af%e3%83%8b%e3%83%83%e3%82%af%e3%81%a7%e6%a5%ad%e5%8b%99%e5%8a%b9","status":"publish","type":"post","link":"https:\/\/hajidai.com\/excel\/2024\/12\/excel%e3%83%9e%e3%82%af%e3%83%ad%e3%81%ae%e9%81%94%e4%ba%ba%e6%8a%80%ef%bc%815%e3%81%a4%e3%81%ae%e4%b8%8a%e7%b4%9a%e3%83%86%e3%82%af%e3%83%8b%e3%83%83%e3%82%af%e3%81%a7%e6%a5%ad%e5%8b%99%e5%8a%b9\/","title":{"rendered":"Excel\u30de\u30af\u30ed\u306e\u9054\u4eba\u6280\uff015\u3064\u306e\u4e0a\u7d1a\u30c6\u30af\u30cb\u30c3\u30af\u3067\u696d\u52d9\u52b9\u7387\u3092\u5287\u7684\u306b\u5411\u4e0a\u3055\u305b\u308b\u65b9\u6cd5"},"content":{"rendered":"<h2>\u4e0a\u7d1a\u8005\u5411\u3051Excel\u30de\u30af\u30ed: \u30c7\u30fc\u30bf\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3059\u308b<\/h2>\n<p>\u4ee5\u4e0b\u306e\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u306f\u3001\u9078\u629e\u3057\u305f\u30bb\u30eb\u7bc4\u56f2\u5185\u306e\u6570\u5024\u3092\u5408\u8a08\u3057\u3001\u7d50\u679c\u3092\u65b0\u3057\u3044\u30b7\u30fc\u30c8\u306b\u8868\u793a\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u51e6\u7406\u3092\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>&#8220;`vba<br \/>\nSub SumSelectedCells()<br \/>\n    Dim rng As Range<br \/>\n    Dim total As Double<\/p>\n<p>    Set rng = Selection<br \/>\n    total = WorksheetFunction.Sum(rng)<\/p>\n<p>    Sheets.Add.Name = &#8220;\u5408\u8a08\u7d50\u679c&#8221;<br \/>\n    Sheets(&#8220;\u5408\u8a08\u7d50\u679c&#8221;).Range(&#8220;A1&#8221;).Value = &#8220;\u9078\u629e\u7bc4\u56f2\u306e\u5408\u8a08&#8221;<br \/>\n    Sheets(&#8220;\u5408\u8a08\u7d50\u679c&#8221;).Range(&#8220;B1&#8221;).Value = total<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<h3>1. VBA\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u57fa\u672c\u539f\u5247<\/h3>\n<p>VBA\u3067Excel \u30de\u30af\u30ed\u3092\u4f5c\u6210\u3059\u308b\u969b\u3001\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\uff08OOP\uff09\u306e\u539f\u5247\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u52b9\u7387\u7684\u3067\u4fdd\u5b88\u6027\u306e\u9ad8\u3044\u30b3\u30fc\u30c9\u3092\u66f8\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002OOP\u306e\u4e3b\u8981\u306a\u6982\u5ff5\u306b\u306f\u3001\u30ab\u30d7\u30bb\u30eb\u5316\u3001\u7d99\u627f\u3001\u30dd\u30ea\u30e2\u30fc\u30d5\u30a3\u30ba\u30e0\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n<p>\u30ab\u30d7\u30bb\u30eb\u5316\u3068\u306f\u3001\u30c7\u30fc\u30bf\u3068\u305d\u308c\u3092\u64cd\u4f5c\u3059\u308b\u30e1\u30bd\u30c3\u30c9\u30921\u3064\u306e\u30e6\u30cb\u30c3\u30c8\uff08\u30af\u30e9\u30b9\uff09\u306b\u307e\u3068\u3081\u308b\u3053\u3068\u3067\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30b3\u30fc\u30c9\u306e\u518d\u5229\u7528\u6027\u304c\u9ad8\u307e\u308a\u3001\u30c7\u30d0\u30c3\u30b0\u3082\u5bb9\u6613\u306b\u306a\u308a\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u30c7\u30fc\u30bf\u51e6\u7406\u7528\u306e\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3057\u3001\u305d\u306e\u30af\u30e9\u30b9\u5185\u306b\u30c7\u30fc\u30bf\u306e\u8aad\u307f\u53d6\u308a\u3001\u8a08\u7b97\u3001\u51fa\u529b\u306e\u30e1\u30bd\u30c3\u30c9\u3092\u542b\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<h3>2. \u30af\u30e9\u30b9\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u6d3b\u7528<\/h3>\n<p>Excel\u30de\u30af\u30ed\u3067\u30af\u30e9\u30b9\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30b3\u30fc\u30c9\u306e\u69cb\u9020\u5316\u3068\u518d\u5229\u7528\u6027\u304c\u5411\u4e0a\u3057\u307e\u3059\u3002\u30af\u30e9\u30b9\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u3001\u95a2\u9023\u3059\u308b\u30c7\u30fc\u30bf\u3068\u6a5f\u80fd\u3092\u30b0\u30eb\u30fc\u30d7\u5316\u3059\u308b\u305f\u3081\u306e\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u9867\u5ba2\u30c7\u30fc\u30bf\u3092\u51e6\u7406\u3059\u308b\u305f\u3081\u306e\u30af\u30e9\u30b9\u3092\u4f5c\u6210\u3059\u308b\u5834\u5408\uff1a<\/p>\n<p>&#8220;`vba<br \/>\n&#8216;CustomerClass.cls<br \/>\nPrivate pName As String<br \/>\nPrivate pEmail As String<\/p>\n<p>Public Property Let Name(value As String)<br \/>\n    pName = value<br \/>\nEnd Property<\/p>\n<p>Public Property Get Name() As String<br \/>\n    Name = pName<br \/>\nEnd Property<\/p>\n<p>Public Property Let Email(value As String)<br \/>\n    pEmail = value<br \/>\nEnd Property<\/p>\n<p>Public Property Get Email() As String<br \/>\n    Email = pEmail<br \/>\nEnd Property<\/p>\n<p>Public Sub DisplayInfo()<br \/>\n    MsgBox &#8220;Name: &#8221; &#038; pName &#038; vbNewLine &#038; &#8220;Email: &#8221; &#038; pEmail<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u30af\u30e9\u30b9\u3092\u4f7f\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u9867\u5ba2\u30c7\u30fc\u30bf\u306e\u7ba1\u7406\u304c\u5bb9\u6613\u306b\u306a\u308a\u3001\u30b3\u30fc\u30c9\u306e\u53ef\u8aad\u6027\u3082\u5411\u4e0a\u3057\u307e\u3059\u3002<\/p>\n<h3>3. \u30a4\u30d9\u30f3\u30c8\u99c6\u52d5\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306e\u6d3b\u7528<\/h3>\n<p>Excel\u30de\u30af\u30ed\u3067\u30a4\u30d9\u30f3\u30c8\u99c6\u52d5\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u6d3b\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u30a2\u30af\u30b7\u30e7\u30f3\u306b\u5fdc\u3058\u3066\u81ea\u52d5\u7684\u306b\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u30a8\u30af\u30b9\u30da\u30ea\u30a8\u30f3\u30b9\u304c\u5411\u4e0a\u3057\u3001\u4f5c\u696d\u52b9\u7387\u3082\u4e0a\u304c\u308a\u307e\u3059\u3002<\/p>\n<p>\u4f8b\u3048\u3070\u3001\u7279\u5b9a\u306e\u30bb\u30eb\u304c\u5909\u66f4\u3055\u308c\u305f\u3068\u304d\u306b\u81ea\u52d5\u7684\u306b\u8a08\u7b97\u3092\u5b9f\u884c\u3059\u308b\u30b3\u30fc\u30c9\u306f\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059\uff1a<\/p>\n<p>&#8220;`vba<br \/>\nPrivate Sub Worksheet_Change(ByVal Target As Range)<br \/>\n    If Not Intersect(Target, Range(&#8220;A1:A10&#8221;)) Is Nothing Then<br \/>\n        &#8216; A1:A10\u306e\u3044\u305a\u308c\u304b\u306e\u30bb\u30eb\u304c\u5909\u66f4\u3055\u308c\u305f\u5834\u5408\u306e\u51e6\u7406<br \/>\n        CalculateTotal<br \/>\n    End If<br \/>\nEnd Sub<\/p>\n<p>Private Sub CalculateTotal()<br \/>\n    &#8216; \u5408\u8a08\u3092\u8a08\u7b97\u3059\u308b\u30ed\u30b8\u30c3\u30af<br \/>\n    Range(&#8220;B1&#8221;).Value = WorksheetFunction.Sum(Range(&#8220;A1:A10&#8221;))<br \/>\nEnd Sub<br \/>\n&#8220;`<\/p>\n<p>\u3053\u306e\u3088\u3046\u306a\u30a4\u30d9\u30f3\u30c8\u99c6\u52d5\u306e\u30a2\u30d7\u30ed\u30fc\u30c1\u306b\u3088\u308a\u3001\u30e6\u30fc\u30b6\u30fc\u306e\u64cd\u4f5c\u306b\u5fdc\u3058\u3066\u30ea\u30a2\u30eb\u30bf\u30a4\u30e0\u3067\u51e6\u7406\u3092\u5b9f\u884c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>VBA\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u6307\u5411\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u6d3b\u7528\u3057\u305fExcel\u30de\u30af\u30ed\u306e\u958b\u767a\u306f\u3001\u5927\u898f\u6a21\u3067\u8907\u96d1\u306a\u696d\u52d9\u30d7\u30ed\u30bb\u30b9\u306e\u81ea\u52d5\u5316\u306b\u7279\u306b\u6709\u52b9\u3067\u3059\u3002\u9069\u5207\u306b\u8a2d\u8a08\u3055\u308c\u305f\u30af\u30e9\u30b9\u3068\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u7d44\u307f\u5408\u308f\u305b\u308b\u3053\u3068\u3067\u3001\u4fdd\u5b88\u6027\u304c\u9ad8\u304f\u3001\u62e1\u5f35\u6027\u306e\u3042\u308b\u30bd\u30ea\u30e5\u30fc\u30b7\u30e7\u30f3\u3092\u69cb\u7bc9\u3067\u304d\u307e\u3059\u3002\u3055\u3089\u306b\u3001\u30a4\u30d9\u30f3\u30c8\u99c6\u52d5\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u3092\u53d6\u308a\u5165\u308c\u308b\u3053\u3068\u3067\u3001\u3088\u308a\u30a4\u30f3\u30bf\u30e9\u30af\u30c6\u30a3\u30d6\u3067\u52b9\u7387\u7684\u306aExcel\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3092\u4f5c\u6210\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n<p>\u3053\u308c\u3089\u306e\u9ad8\u5ea6\u306a\u8a2d\u8a08\u624b\u6cd5\u3092\u7fd2\u5f97\u3057\u3001\u5b9f\u8df5\u3059\u308b\u3053\u3068\u3067\u3001Excel\u3092\u5358\u306a\u308b\u8868\u8a08\u7b97\u30c4\u30fc\u30eb\u304b\u3089\u5f37\u529b\u306a\u696d\u52d9\u81ea\u52d5\u5316\u30d7\u30e9\u30c3\u30c8\u30d5\u30a9\u30fc\u30e0\u3078\u3068\u9032\u5316\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4e0a\u7d1a\u8005\u5411\u3051Excel\u30de\u30af\u30ed: \u30c7\u30fc\u30bf\u51e6\u7406\u3092\u81ea\u52d5\u5316\u3059\u308b \u4ee5\u4e0b\u306e\u30de\u30af\u30ed\u30b3\u30fc\u30c9\u306f\u3001\u9078\u629e\u3057\u305f\u30bb\u30eb\u7bc4\u56f2\u5185\u306e\u6570\u5024\u3092\u5408\u8a08\u3057\u3001\u7d50\u679c\u3092\u65b0\u3057\u3044\u30b7\u30fc\u30c8\u306b\u8868\u793a\u3057\u307e\u3059\u3002\u3053\u308c\u306b\u3088\u308a\u3001\u5927\u91cf\u306e\u30c7\u30fc\u30bf\u51e6\u7406\u3092\u52b9\u7387\u5316\u3067\u304d\u307e\u3059\u3002 #8220;`vba Sub<\/p>\n","protected":false},"author":2,"featured_media":294,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[5],"tags":[],"class_list":["post-295","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-advanced"],"_links":{"self":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/295","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/comments?post=295"}],"version-history":[{"count":0,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/posts\/295\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media\/294"}],"wp:attachment":[{"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/media?parent=295"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/categories?post=295"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/hajidai.com\/excel\/wp-json\/wp\/v2\/tags?post=295"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}