{"id":1711,"date":"2021-04-24T08:23:27","date_gmt":"2021-04-24T00:23:27","guid":{"rendered":"http:\/\/cnliutz.uicp.io\/?p=1711"},"modified":"2021-04-24T08:23:51","modified_gmt":"2021-04-24T00:23:51","slug":"%e5%8d%95%e5%85%83%e6%a0%bc%e9%80%89%e6%8b%a9%e5%a4%8d%e5%88%b6","status":"publish","type":"post","link":"http:\/\/g1n29wqq.ipyingshe.net:5347\/?p=1711","title":{"rendered":"Excel VBA\u5355\u5143\u683c\u9009\u62e9\u590d\u5236"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>Sub prt()\n    Debug.Print Workbooks(\"\u5de5\u4f5c\u7c3f1.xlsx\").Name\n    Debug.Print Worksheets.Count\n    'a1 copy to a5\n    Range(\"a1\").Copy Range(\"a5\")\n    '\u533a\u57df\u590d\u5236\n    Range(\"a1:c10\").Select\n    Selection.Copy\n    Range(\"d1\").Select\n    ActiveSheet.Paste\n    &#91;a1:b4].Value = Rnd() * 100\n       xlRow = Application.Cells(Rows.Count, 1).End(xlUp).Row\n    Debug.Print xlRow\n    'select\n    Worksheets(\"Sheet1\").Activate\n    numRows = Selection.Rows.Count\n    numColumns = Selection.Columns.Count\n    Selection.Resize(numRows + 1, numColumns + 1).Select\n     'select no title\n    Set tbl = ActiveCell.CurrentRegion\n    tbl.Offset(1, 0).Resize(tbl.Rows.Count - 1, _\n     tbl.Columns.Count).Select\n     Range(\"b2\").CurrentRegion.Select\nEnd Sub\n\nSub ChangeInsertRows()\n    '\u4e24\u884c\u5f00\u59cb\u5217\u6570\u503c\u4e0d\u540c\u662f\uff0c\u63d2\u5165\u4e00\u884c\n    Application.ScreenUpdating = False\n    Dim xRow As Long\n    For xRow = Application.Cells(Rows.Count, 1).End(xlUp).Row To 3 Step -1\n        If Application.Cells(xRow, 1).Value &lt;&gt; Application.Cells(xRow - 1, 1).Value Then             Rows(xRow).Resize(1).Insert\n    Next xRow\n    \n    Application.ScreenUpdating = True\nEnd Sub\nSub adds()\n    &#91;a1:b10].Clear\n    ActiveSheet.Range(\"a65536\").End(xlUp).Offset(1, 0).Value = \"\u5f20\u4e09\"\nEnd Sub\n<\/code><\/pre>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[6],"tags":[],"class_list":["post-1711","post","type-post","status-publish","format-standard","hentry","category-6"],"_links":{"self":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1711","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1711"}],"version-history":[{"count":2,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions"}],"predecessor-version":[{"id":1713,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=\/wp\/v2\/posts\/1711\/revisions\/1713"}],"wp:attachment":[{"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1711"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1711"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/g1n29wqq.ipyingshe.net:5347\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1711"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}