{"id":472,"date":"2018-06-29T07:58:30","date_gmt":"2018-06-29T07:58:30","guid":{"rendered":"http:\/\/mio-web.net\/pcsupport\/?p=472"},"modified":"2018-06-29T07:58:30","modified_gmt":"2018-06-29T07:58:30","slug":"excel-vba-%e3%80%80union%e3%83%a1%e3%82%bd%e3%83%83%e3%83%89","status":"publish","type":"post","link":"https:\/\/mio-web.net\/pcsupport\/archives\/472\/","title":{"rendered":"Excel VBA \u3000Union\u30e1\u30bd\u30c3\u30c9"},"content":{"rendered":"<p>\u30a8\u30af\u30bb\u30eb\u306eVBA\u3067\u7279\u5b9a\u306e\u884c\u3092\u524a\u9664\u3057\u305f\u3044\u6642\u3001Range\u578b\u306e\u5909\u6570\u306b\u3001\u7279\u5b9a\u306e\u884c\u5168\u4f53\u3092\u8ffd\u52a0\u3057\u3066\u3086\u304d\u3001<br \/>\n\u8ffd\u52a0\u3055\u308c\u305f\u7bc4\u56f2\u5168\u4f53\u3092\u307e\u3068\u3081\u3066\u524a\u9664\u3059\u308b\u65b9\u6cd5\u304c\u901f\u3044\u3088\u3046\u3067\u3042\u308b\u3002<br \/>\n\u305f\u3060\u3057ACCESS\u304b\u3089\u547c\u3073\u51fa\u3059\u3068\u304d\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3042\u308b\u3002<br \/>\nUnion\u30e1\u30bd\u30c3\u30c9\u306e\u524d\u306b\u30a8\u30af\u30bb\u30eb\u30a2\u30d7\u30ea\u30b1\u30fc\u30b7\u30e7\u30f3\u3067\u3042\u308b\u3053\u3068\u3092\u660e\u793a\u3059\u308b\u5fc5\u8981\u304c\u3042\u308b\uff08xls.Union\u3000\u306e\u3088\u3046\u306b\uff09<\/p>\n<p>&#8216;\u30aa\u30d6\u30b8\u30a7\u30af\u30c8\u3078\u306e\u53c2\u7167\u3092\u53d6\u5f97 &#8211; Excel<br \/>\nSet xls = CreateObject(&#8220;Excel.Application&#8221;)<br \/>\nSet wkb = xls.Workbooks.Add(Template:=********&#8221;)<br \/>\nSet wksSource = wkb.Worksheets(&#8220;*****&#8221;)<\/p>\n<p>    Dim Del_R As Range &#8216;\u524a\u9664\u3057\u305f\u3044\u9818\u57df<br \/>\n    Dim i As Long<br \/>\n With wksSource<br \/>\n   &#8216;5\u884c\u76ee\u304b\u3089150\u307e\u3067P\u5217\u306e\u30bb\u30eb\u3092\u30c1\u30a7\u30c3\u30af\u3057\u307e\u3059<br \/>\n      For i = 5 To 150<\/p>\n<p>        &#8216;P\u5217\u306e\u30bb\u30eb\u304c0\u306a\u3089\u5909\u6570 Del_R \u306b\u8ffd\u52a0<br \/>\n        If .Cells(i, 16).Value = 0 Then<br \/>\n            &#8216;\u6700\u521d\u306e\u7a7a\u767d\u884c\u306b\u51fa\u4f1a\u3063\u305f\u3089\u884c\u5168\u4f53\u3092 KuhakuGyo \u306b\u30bb\u30c3\u30c8<br \/>\n            If Del_R Is Nothing Then<br \/>\n                Set Del_R = .Rows(i).EntireRow<br \/>\n            &#8216;2\u4ef6\u76ee\u304b\u3089\u306f\u9806\u6b21 Del_R \u306b\u8ffd\u52a0\u3057\u3066\u3044\u304f<br \/>\n            Else<br \/>\n                Set Del_R = xls.Union(Del_R, .Rows(i).EntireRow)<br \/>\n            End If<br \/>\n        End If<br \/>\n        Next i<br \/>\n    End With<\/p>\n<p>    &#8216;\u7a7a\u767d\u884c\u304c\u3042\u308c\u3070\u4e00\u62ec\u3067\u524a\u9664\u3059\u308b<br \/>\n    If NotDel_R Is Nothing Then<br \/>\n        Del_R.Delete<br \/>\n    End If<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u30a8\u30af\u30bb\u30eb\u306eVBA\u3067\u7279\u5b9a\u306e\u884c\u3092\u524a\u9664\u3057\u305f\u3044\u6642\u3001Range\u578b\u306e\u5909\u6570\u306b\u3001\u7279\u5b9a\u306e\u884c\u5168\u4f53\u3092\u8ffd\u52a0\u3057\u3066\u3086\u304d\u3001 \u8ffd\u52a0\u3055\u308c\u305f\u7bc4\u56f2\u5168\u4f53\u3092\u307e\u3068\u3081\u3066\u524a\u9664\u3059\u308b\u65b9\u6cd5\u304c\u901f\u3044\u3088\u3046\u3067\u3042\u308b\u3002 \u305f\u3060\u3057ACCESS\u304b\u3089\u547c\u3073\u51fa\u3059\u3068\u304d\u306b\u306f\u6ce8\u610f\u304c\u5fc5\u8981\u3067\u3042\u308b\u3002 Unio [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"vkexunit_cta_each_option":"","footnotes":""},"categories":[32],"tags":[],"class_list":["post-472","post","type-post","status-publish","format-standard","hentry","category-excel"],"_links":{"self":[{"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/posts\/472","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/comments?post=472"}],"version-history":[{"count":1,"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/posts\/472\/revisions"}],"predecessor-version":[{"id":473,"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/posts\/472\/revisions\/473"}],"wp:attachment":[{"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/media?parent=472"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/categories?post=472"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mio-web.net\/pcsupport\/wp-json\/wp\/v2\/tags?post=472"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}