<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>VBA on 樊尘刹记</title>
		<link>http://localhost:1313/tags/vba/</link>
		<description>Recent content in VBA on 樊尘刹记</description>
		<generator>Hugo</generator>
		<language>zh-CN</language>
		
			<managingEditor>richffan@outlook.com (richfan)</managingEditor>
		
		
			<webMaster>richffan@outlook.com (richfan)</webMaster>
		
		
		
			<lastBuildDate>Mon, 23 Oct 2023 00:00:00 +0800</lastBuildDate>
		
			<atom:link href="http://localhost:1313/tags/vba/index.xml" rel="self" type="application/rss+xml" />
			<item>
				<title>【VBA案例001】实现VLOOKUP功能</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B001%E5%AE%9E%E7%8E%B0vlookup%E5%8A%9F%E8%83%BD.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B001%E5%AE%9E%E7%8E%B0vlookup%E5%8A%9F%E8%83%BD.html</guid>
				<description>&lt;h2 id=&#34;vba实现vlookup函数功能&#34;&gt;VBA实现VLOOKUP函数功能&lt;/h2&gt;&#xA;&lt;table&gt;&#xA;&#x9;&lt;thead&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;数据&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;VBA&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;th&gt;&lt;/th&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/thead&gt;&#xA;&#x9;&lt;tbody&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;姓名&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;年龄&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;姓名&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;年龄&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;潘全桂&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;24&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;荆琛泽&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;霍栋保&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;35&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;吉栋松&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;荆琛泽&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;24&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;百里刚晓&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;越伦信&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;25&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;农康雪&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;吉栋松&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;34&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;越伦信&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;桂真顺&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;27&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;霍栋保&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;百里刚晓&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;19&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;潘全桂&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&#x9;&#x9;&lt;tr&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;农康雪&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;33&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;桂真顺&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&#x9;&#x9;&lt;td&gt;&lt;/td&gt;&#xA;&#x9;&#x9;&#x9;&lt;/tr&gt;&#xA;&#x9;&lt;/tbody&gt;&#xA;&lt;/table&gt;&#xA;&lt;h2 id=&#34;直接附上vba代码&#34;&gt;直接附上VBA代码：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;&amp;#39;Option Explicit&#xA;&#xA;Sub 单元格循环()&#xA;    Dim cel As Range&#xA;    Dim cel2 As Range&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    [e6:e13] = &amp;#34;&amp;#34;&#xA;    For Each cel In Range(&amp;#34;a6:a13&amp;#34;)&#xA;        For Each cel2 In Range(&amp;#34;d6:d13&amp;#34;)&#xA;            If cel.Value = cel2.Value Then&#xA;                cel2.Offset(0, 1).Value = cel.Offset(0, 1).Value&#xA;                Exit For&#xA;            End If&#xA;        Next&#xA;    Next&#xA;    Debug.Print Format(Timer - t, &amp;#34;0.00000000000000s&amp;#34;)&#xA;End Sub&#xA;&#xA;Sub 数组循环()&#xA;    Dim ar, br&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    [e6:e13] = &amp;#34;&amp;#34;&#xA;    ar = [a6:b13] &amp;#39;range(&amp;#34;a6:b13&amp;#34;)&#xA;    br = [d6:e13]&#xA;&#xA;    Dim i, j&#xA;    For i = 1 To UBound(ar)&#xA;        For j = 1 To UBound(ar)&#xA;            If ar(i, 1) = br(j, 1) Then&#xA;                br(j, 2) = ar(i, 2)&#xA;                Exit For&#xA;            End If&#xA;        Next j&#xA;    Next i&#xA;&#xA;    [d6:e13] = br&#xA;    Debug.Print Format(Timer - t, &amp;#34;0.00000000000000s&amp;#34;)&#xA;End Sub&#xA;&#xA;Sub 字典循环()&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;    Dim ar, br&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    [e6:e13] = &amp;#34;&amp;#34;&#xA;    ar = [a6:b13] &amp;#39;range(&amp;#34;a6:b13&amp;#34;)&#xA;    br = [d6:e13]&#xA;&#xA;    Dim i, j&#xA;    For i = 1 To UBound(ar)&#xA;        d(ar(i, 1)) = ar(i, 2) &amp;#39;KEY ITEM&#xA;    Next i&#xA;&#xA;    For j = 1 To UBound(br)&#xA;        br(j, 2) = d(br(j, 1))&#xA;    Next j&#xA;&#xA;    [d6:e13] = br&#xA;    Debug.Print Format(Timer - t, &amp;#34;0.00000000000000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247484991&amp;amp;idx=1&amp;amp;sn=a927b9a6a9a79b2c568fe0e9dbbbc307&amp;amp;chksm=e8bccf68dfcb467e9b7852aa0733798a77f134e89be55e732fee7c57afced35a919993e62809&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例002】一对多查询</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B002%E4%B8%80%E5%AF%B9%E5%A4%9A%E6%9F%A5%E8%AF%A2.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B002%E4%B8%80%E5%AF%B9%E5%A4%9A%E6%9F%A5%E8%AF%A2.html</guid>
				<description>&lt;p&gt;一对多查询的方法有很多，这里附上VBA代码，详细过程请看文章最后的视频。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B002%E3%80%91%E4%B8%80%E5%AF%B9%E5%A4%9A%E6%9F%A5%E8%AF%A2_1.png&#34; alt=&#34;&#34;&gt;&#xA;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B002%E3%80%91%E4%B8%80%E5%AF%B9%E5%A4%9A%E6%9F%A5%E8%AF%A2_2.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 单元格循环()&#xA;    Dim i, j, k, irow&#xA;    Dim cel As Range&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents&#xA;    Dim str As String&#xA;    str = Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;b3&amp;#34;)&#xA;&#xA;    k = 5&#xA;    With Sheets(&amp;#34;数据源&amp;#34;)&#xA;        For Each cel In .Range(&amp;#34;a2:d&amp;#34; &amp;amp; .[a65536].End(3).Row) &amp;#39;xlup&#xA;            If cel.Value = str Then&#xA;                k = k + 1&#xA;                For j = 1 To 4&#xA;                    Sheets(&amp;#34;查询&amp;#34;).Cells(k, j) = cel.Offset(0, j - 1)&#xA;                Next&#xA;            End If&#xA;        Next&#xA;    End With&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 数组循环()&#xA;    Dim i, j, k, irow&#xA;    Dim cel As Range&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents&#xA;    Dim str As String&#xA;    str = Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;b3&amp;#34;)&#xA;&#xA;    Dim ar, br() &amp;#39;ar 数据源 ,br 结果&#xA;    With Sheets(&amp;#34;数据源&amp;#34;)&#xA;        irow = .[a65536].End(3).Row&#xA;        ar = .Range(&amp;#34;a2:d&amp;#34; &amp;amp; irow)&#xA;    End With&#xA;&#xA;    ReDim br(1 To UBound(ar), 1 To UBound(ar, 2))&#xA;    For i = 1 To UBound(ar)&#xA;        If ar(i, 1) = str Then&#xA;            k = k + 1&#xA;            For j = 1 To UBound(br, 2)&#xA;                br(k, j) = ar(i, j)&#xA;            Next j&#xA;        End If&#xA;    Next i&#xA;&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6&amp;#34;).Resize(k, UBound(br, 2)) = br&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法三&#34;&gt;方法三：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 字典查询()&#xA;    Dim i, j, k, irow&#xA;    Dim cel As Range&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents&#xA;    Dim str As String&#xA;    str = Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;b3&amp;#34;)&#xA;&#xA;    Dim ar, br() &amp;#39;ar 数据源 ,br 结果&#xA;    With Sheets(&amp;#34;数据源&amp;#34;)&#xA;        irow = .[a65536].End(3).Row&#xA;        ar = .Range(&amp;#34;a2:d&amp;#34; &amp;amp; irow)&#xA;    End With&#xA;&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;&#xA;    For i = 1 To UBound(ar)&#xA;        If Not d.exists(ar(i, 1)) Then&#xA;            d(ar(i, 1)) = i&#xA;        Else&#xA;            d(ar(i, 1)) = d(ar(i, 1)) &amp;amp; &amp;#34;,&amp;#34; &amp;amp; i&#xA;        End If&#xA;    Next i&#xA;&#xA;    Dim tmpAr&#xA;    tmpAr = Split(d(str), &amp;#34;,&amp;#34;)&#xA;&#xA;    ReDim br(1 To UBound(tmpAr) + 1, 1 To UBound(ar, 2))&#xA;    For i = 0 To UBound(tmpAr)&#xA;        For j = 1 To UBound(ar, 2)&#xA;            br(i + 1, j) = ar(tmpAr(i), j)&#xA;        Next j&#xA;    Next i&#xA;&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6&amp;#34;).Resize(UBound(br), UBound(br, 2)) = br&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法四&#34;&gt;方法四：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub SQL查询()&#xA;    &amp;#39;定义变量&#xA;    Dim cnn, rst, SQL$&#xA;    Dim i, j, k&#xA;    Set cnn = CreateObject(&amp;#34;adodb.connection&amp;#34;) &amp;#39;创建数据库连接&#xA;    Set rst = CreateObject(&amp;#34;adodb.recordset&amp;#34;) &amp;#39;创建一个数据集保存数据&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    &amp;#39;设置数据库连接&#xA;    If Val(Application.Version) &amp;lt; 12 Then&#xA;        cnn.Open &amp;#34;Provider=Microsoft.Jet.Oledb.4.0;Extended Properties=&amp;#39;Excel 8.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    Else&#xA;        cnn.Open &amp;#34;Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=&amp;#39;Excel 12.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    End If&#xA;&#xA;    &amp;#39;设置SQL语句&#xA;    SQL = &amp;#34;SELECT * FROM [数据源$a1:d100] WHERE 班级=&amp;#39;&amp;#34; &amp;amp; Sheets(&amp;#34;查询&amp;#34;).[B3] &amp;amp; &amp;#34;&amp;#39;&amp;#34;&#xA;&#xA;    &amp;#39;SQL结果处理&#xA;    Set rst = cnn.Execute(SQL)&#xA;&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents &amp;#39;清理保存数据的区域&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6&amp;#34;).CopyFromRecordset rst &amp;#39;结果输出（不带表头）&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;    rst.Close&#xA;    cnn.Close &amp;#39;关闭数据库连接&#xA;    Set rst = Nothing&#xA;    Set cnn = Nothing &amp;#39;将cnn从内存中删除&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485016&amp;amp;idx=1&amp;amp;sn=03ab36893d1e13a10e605f572ca30038&amp;amp;chksm=e8bccf0fdfcb46192da110df69748b7fa65fb2cea568055237e818074b0e076fb0da12aff279&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例003】模糊查询</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B003%E6%A8%A1%E7%B3%8A%E6%9F%A5%E8%AF%A2.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B003%E6%A8%A1%E7%B3%8A%E6%9F%A5%E8%AF%A2.html</guid>
				<description>&lt;p&gt;大家好，模糊查询，在平时工作中会经常遇到。&lt;/p&gt;&#xA;&lt;p&gt;本期呢，会将模糊查询的两个最常用的方法分享给大家。&lt;/p&gt;&#xA;&lt;p&gt;1、instr函数&#xA;2、like运算符&lt;/p&gt;&#xA;&lt;p&gt;在开始之前，我建议先把上一期的【VBA案例002】一对多查询看一遍。因为本次内容是基于上次的文件衍生出来的。并且代码也大同小异。&lt;/p&gt;&#xA;&lt;p&gt;先附上VBA代码，详细内容，请看文章最后的视频哦！~&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 单元格循环()&#xA;    Dim i, j, k, irow&#xA;    Dim cel As Range&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents&#xA;    Dim str As String&#xA;    str = Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;b3&amp;#34;)&#xA;&#xA;    k = 5&#xA;    With Sheets(&amp;#34;数据源&amp;#34;)&#xA;        For Each cel In .Range(&amp;#34;a2:d&amp;#34; &amp;amp; .[a65536].End(3).Row) &amp;#39;xlup&#xA;            &amp;#39;If cel.Value = str Then&#xA;            &amp;#39;If InStr(cel.Value, str) &amp;gt; 0 Then&#xA;            If cel.Value Like &amp;#34;*&amp;#34; &amp;amp; str &amp;amp; &amp;#34;*&amp;#34; Then&#xA;                k = k + 1&#xA;                For j = 1 To 4&#xA;                    Sheets(&amp;#34;查询&amp;#34;).Cells(k, j) = cel.Offset(0, j - 1)&#xA;                Next&#xA;            End If&#xA;        Next&#xA;    End With&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 数组循环()&#xA;    Dim i, j, k, irow&#xA;    Dim cel As Range&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents&#xA;    Dim str As String&#xA;    str = Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;b3&amp;#34;)&#xA;&#xA;    Dim ar, br() &amp;#39;ar 数据源 ,br 结果&#xA;    With Sheets(&amp;#34;数据源&amp;#34;)&#xA;        irow = .[a65536].End(3).Row&#xA;        ar = .Range(&amp;#34;a2:d&amp;#34; &amp;amp; irow)&#xA;    End With&#xA;&#xA;    ReDim br(1 To UBound(ar), 1 To UBound(ar, 2))&#xA;    For i = 1 To UBound(ar)&#xA;        &amp;#39;If ar(i, 1) = str Then&#xA;        &amp;#39;If InStr(ar(i, 1), str) &amp;gt; 0 Then&#xA;        If ar(i, 1) Like &amp;#34;*&amp;#34; &amp;amp; str &amp;amp; &amp;#34;*&amp;#34; Then&#xA;            k = k + 1&#xA;            For j = 1 To UBound(br, 2)&#xA;                br(k, j) = ar(i, j)&#xA;            Next j&#xA;        End If&#xA;    Next i&#xA;&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6&amp;#34;).Resize(k, UBound(br, 2)) = br&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h3 id=&#34;方法三&#34;&gt;方法三：&lt;/h3&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 字典查询()&#xA;    Dim i, j, k, irow&#xA;    Dim cel As Range&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents&#xA;    Dim str As String&#xA;    str = Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;b3&amp;#34;)&#xA;&#xA;    Dim ar, br() &amp;#39;ar 数据源 ,br 结果&#xA;    With Sheets(&amp;#34;数据源&amp;#34;)&#xA;        irow = .[a65536].End(3).Row&#xA;        ar = .Range(&amp;#34;a2:d&amp;#34; &amp;amp; irow)&#xA;    End With&#xA;&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;&#xA;    For i = 1 To UBound(ar)&#xA;        &amp;#39;If InStr(ar(i, 1), str) &amp;gt; 0 Then&#xA;        If ar(i, 1) Like &amp;#34;*&amp;#34; &amp;amp; str &amp;amp; &amp;#34;*&amp;#34; Then&#xA;            If Not d.exists(str) Then&#xA;                d(str) = i&#xA;            Else&#xA;                d(str) = d(str) &amp;amp; &amp;#34;,&amp;#34; &amp;amp; i&#xA;            End If&#xA;        End If&#xA;    Next i&#xA;&#xA;    Dim tmpAr&#xA;    tmpAr = Split(d(str), &amp;#34;,&amp;#34;)&#xA;&#xA;    ReDim br(1 To UBound(tmpAr) + 1, 1 To UBound(ar, 2))&#xA;    For i = 0 To UBound(tmpAr)&#xA;        For j = 1 To UBound(ar, 2)&#xA;            br(i + 1, j) = ar(tmpAr(i), j)&#xA;        Next j&#xA;    Next i&#xA;&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6&amp;#34;).Resize(UBound(br), UBound(br, 2)) = br&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法四&#34;&gt;方法四：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub SQL查询()&#xA;    &amp;#39;定义变量&#xA;    Dim cnn, rst, SQL$&#xA;    Dim i, j, k&#xA;    Set cnn = CreateObject(&amp;#34;adodb.connection&amp;#34;) &amp;#39;创建数据库连接&#xA;    Set rst = CreateObject(&amp;#34;adodb.recordset&amp;#34;) &amp;#39;创建一个数据集保存数据&#xA;    Dim t As Double&#xA;    t = Timer&#xA;    &amp;#39;设置数据库连接&#xA;    If Val(Application.Version) &amp;lt; 12 Then&#xA;        cnn.Open &amp;#34;Provider=Microsoft.Jet.Oledb.4.0;Extended Properties=&amp;#39;Excel 8.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    Else&#xA;        cnn.Open &amp;#34;Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=&amp;#39;Excel 12.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    End If&#xA;&#xA;    &amp;#39;设置SQL语句&#xA;    &amp;#39;SQL = &amp;#34;SELECT * FROM [数据源$a1:d100] WHERE 班级=&amp;#39;&amp;#34; &amp;amp; Sheets(&amp;#34;查询&amp;#34;).[B3] &amp;amp; &amp;#34;&amp;#39;&amp;#34;&#xA;    &amp;#39;SQL = &amp;#34;SELECT * FROM [数据源$a1:d100] WHERE instr(班级,&amp;#39;&amp;#34; &amp;amp; Sheets(&amp;#34;查询&amp;#34;).[B3] &amp;amp; &amp;#34;&amp;#39;)&amp;gt;0&amp;#34;&#xA;    SQL = &amp;#34;SELECT * FROM [数据源$a1:d100] WHERE 班级 like &amp;#39;&amp;#34; &amp;amp; Sheets(&amp;#34;查询&amp;#34;).[B3] &amp;amp; &amp;#34;%&amp;#39;&amp;#34;&#xA;    &amp;#39;SQL结果处理&#xA;    Set rst = cnn.Execute(SQL)&#xA;&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6:d65536&amp;#34;).ClearContents &amp;#39;清理保存数据的区域&#xA;    Sheets(&amp;#34;查询&amp;#34;).Range(&amp;#34;a6&amp;#34;).CopyFromRecordset rst &amp;#39;结果输出（不带表头）&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;    rst.Close&#xA;    cnn.Close &amp;#39;关闭数据库连接&#xA;    Set rst = Nothing&#xA;    Set cnn = Nothing &amp;#39;将cnn从内存中删除&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485027&amp;amp;idx=1&amp;amp;sn=e54ce7d71355280dcb3e863977e5bb76&amp;amp;chksm=e8bccf34dfcb46228672ac50507c236d2f5e72b8e7867df75e5ce6a41cc2e2031aa8673563f8&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例004】自动填充表单</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B004%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85%E8%A1%A8%E5%8D%95.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B004%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85%E8%A1%A8%E5%8D%95.html</guid>
				<description>&lt;p&gt;大家好！今天我们分享一个有关VBA自动填充表单的案例，帮助大家简化表单填写的过程，提高工作效率。&lt;/p&gt;&#xA;&lt;p&gt;我们经常需要填写大量重复的表单，例如报销单、数据输入表格等，并且每个表单都有各自的字段需要填写。手动逐个填写这些表单既耗时又容易出错。&lt;/p&gt;&#xA;&lt;p&gt;使用VBA自动填充表单可以极大地简化这一过程，让我们能够更专注于其他重要的工作。&lt;/p&gt;&#xA;&lt;p&gt;譬如说，现在有两个表格，一个是人员清单，另一个的表单。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B004%E3%80%91%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85%E8%A1%A8%E5%8D%95_1.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;现在要做的是，将人员清单中的每一行信息，填到表单里，并导出为一个单独的工作簿。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B004%E3%80%91%E8%87%AA%E5%8A%A8%E5%A1%AB%E5%85%85%E8%A1%A8%E5%8D%95_2.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;下面是VBA的代码分享，你也可以观看下方的视频解析：&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 表格填充()&#xA;&#xA;    Dim i, j, k&#xA;&#xA;    Dim xinXiSht As Worksheet&#xA;    Dim qingDanSht As Worksheet&#xA;&#xA;    Set xinXiSht = ThisWorkbook.Worksheets(&amp;#34;信息卡&amp;#34;)&#xA;    Set qingDanSht = ThisWorkbook.Worksheets(&amp;#34;人员清单&amp;#34;)&#xA;&#xA;    With qingDanSht&#xA;        For i = 2 To .Range(&amp;#34;a&amp;#34; &amp;amp; .Rows.Count).End(xlUp).Row&#xA;            For j = 1 To 5&#xA;                xinXiSht.Range(&amp;#34;c&amp;#34; &amp;amp; j + 4) = .Cells(i, j)&#xA;            Next j&#xA;&#xA;            xinXiSht.Copy&#xA;            ActiveWorkbook.SaveAs ThisWorkbook.Path &amp;amp; &amp;#34;\&amp;#34; &amp;amp; .Range(&amp;#34;a&amp;#34; &amp;amp; i) &amp;amp; &amp;#34;.xlsx&amp;#34;&#xA;            ActiveWorkbook.Close True&#xA;        Next i&#xA;    End With&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 表格填充优化()&#xA;&#xA;    Dim i, j, k&#xA;&#xA;    Dim xinXiSht As Worksheet&#xA;    Dim qingDanSht As Worksheet&#xA;&#xA;    Set xinXiSht = ThisWorkbook.Worksheets(&amp;#34;信息卡&amp;#34;)&#xA;    Set qingDanSht = ThisWorkbook.Worksheets(&amp;#34;人员清单&amp;#34;)&#xA;&#xA;    Application.ScreenUpdating = False&#xA;&#xA;    Dim ar, br()&#xA;    With qingDanSht&#xA;        ar = .Range(&amp;#34;a2:e&amp;#34; &amp;amp; .Range(&amp;#34;a&amp;#34; &amp;amp; .Rows.Count).End(xlUp).Row)&#xA;        For i = 1 To UBound(ar)&#xA;            ReDim br(1 To 5, 1 To 1)&#xA;            For j = 1 To 5&#xA;                br(j, 1) = ar(i, j)&#xA;            Next j&#xA;            xinXiSht.[c5].Resize(UBound(br)) = br&#xA;            xinXiSht.Copy&#xA;            ActiveWorkbook.SaveAs ThisWorkbook.Path &amp;amp; &amp;#34;\&amp;#34; &amp;amp; ar(i, 1) &amp;amp; &amp;#34;.xlsx&amp;#34;&#xA;            ActiveWorkbook.Close True&#xA;            xinXiSht.[c5:c9].ClearContents&#xA;        Next i&#xA;    End With&#xA;&#xA;    Application.ScreenUpdating = True&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485040&amp;amp;idx=1&amp;amp;sn=1f89ff1b2c14a4b22607fcc1ba725ce9&amp;amp;chksm=e8bccf27dfcb463130a13e9e02c0e0534f314ffbfc12cf3697a006cb2b215ebc8db0e1f0c3d5&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例005】自动汇总表单</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B005%E8%87%AA%E5%8A%A8%E6%B1%87%E6%80%BB%E8%A1%A8%E5%8D%95.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B005%E8%87%AA%E5%8A%A8%E6%B1%87%E6%80%BB%E8%A1%A8%E5%8D%95.html</guid>
				<description>&lt;p&gt;大家好！书接上文。&lt;/p&gt;&#xA;&lt;p&gt;有时候，我们需要处理多个工作簿，每个工作簿中包含一些特定的信息。为了将这些信息汇总到一个表中，我们可能需要手动打开每个工作簿，然后复制粘贴所需的数据。但这样做既费时又容易出错。&lt;/p&gt;&#xA;&lt;p&gt;所以，使用VBA依然可以解决这个问题。极大地简化这一过程，让我们能够更专注于其他重要的工作。&lt;/p&gt;&#xA;&lt;p&gt;举个例子，现在我们有100个工作簿。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B005%E3%80%91%E8%87%AA%E5%8A%A8%E6%B1%87%E6%80%BB%E8%A1%A8%E5%8D%95_1.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;需要从里边提取员工信息汇总到一个表里边。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B005%E3%80%91%E8%87%AA%E5%8A%A8%E6%B1%87%E6%80%BB%E8%A1%A8%E5%8D%95_1.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;猜猜看，用VBA处理这些需要多久？&lt;/p&gt;&#xA;&lt;p&gt;下面是VBA的代码分享，你也可以观看下方的视频解析：&lt;/p&gt;&#xA;&lt;p&gt;公共函数：&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Private Function filelist(folderspec, Optional pstr = &amp;#34;*.txt&amp;#34;)&#xA;    On Error GoTo errline&#xA;    Dim fs, f, f1, fc, i, farr&#xA;    Set fs = CreateObject(&amp;#34;Scripting.FileSystemObject&amp;#34;)&#xA;    Set f = fs.GetFolder(folderspec)&#xA;    Set fc = f.Files&#xA;    ReDim farr(1 To fc.Count)&#xA;    For Each f1 In fc&#xA;        If f1.Name Like pstr And Not f1.Name Like &amp;#34;*~$*&amp;#34; Then&#xA;            i = i + 1&#xA;            farr(i) = f1.Name&#xA;        End If&#xA;    Next&#xA;    ReDim Preserve farr(1 To i)&#xA;    filelist = farr&#xA;errline:&#xA;End Function&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法一()&#xA;    Dim i, j, k&#xA;    Dim filePath As String, fileAr&#xA;&#xA;    filePath = ThisWorkbook.Path &amp;amp; &amp;#34;\表单\&amp;#34;&#xA;    fileAr = filelist(filePath, &amp;#34;*.xlsx&amp;#34;)&#xA;&#xA;    Dim t As Double&#xA;    Dim wb As Workbook&#xA;    Application.ScreenUpdating = False&#xA;&#xA;    t = Timer&#xA;&#xA;    k = 1&#xA;    For i = 1 To UBound(fileAr)&#xA;        Set wb = Workbooks.Open(filePath &amp;amp; fileAr(i))&#xA;        With wb.Worksheets(1)&#xA;            k = k + 1&#xA;            For j = 1 To 5&#xA;                ThisWorkbook.Worksheets(&amp;#34;Sheet1&amp;#34;).Cells(k, j) = .Range(&amp;#34;c&amp;#34; &amp;amp; j + 4)&#xA;            Next&#xA;        End With&#xA;        wb.Close False&#xA;    Next i&#xA;    Application.ScreenUpdating = True&#xA;&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法二数组()&#xA;    Dim i, j, k&#xA;    Dim filePath As String, fileAr&#xA;    Dim br(1 To 5000, 1 To 5)&#xA;    filePath = ThisWorkbook.Path &amp;amp; &amp;#34;\表单\&amp;#34;&#xA;    fileAr = filelist(filePath, &amp;#34;*.xlsx&amp;#34;)&#xA;&#xA;    Dim t As Double&#xA;    Dim wb As Workbook&#xA;    Application.ScreenUpdating = False&#xA;&#xA;    t = Timer&#xA;&#xA;    k = 0&#xA;    Dim tmp&#xA;    For i = 1 To UBound(fileAr)&#xA;        Set wb = Workbooks.Open(filePath &amp;amp; fileAr(i))&#xA;&#xA;        With wb.Worksheets(1)&#xA;            tmp = .Range(&amp;#34;c5:c9&amp;#34;)&#xA;            k = k + 1&#xA;            For j = 1 To 5&#xA;                br(i, j) = tmp(j, 1)&#xA;            Next&#xA;        End With&#xA;        wb.Close False&#xA;    Next i&#xA;    ThisWorkbook.Worksheets(1).[a2].Resize(k, UBound(br, 2)) = br&#xA;    Application.ScreenUpdating = True&#xA;&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法三&#34;&gt;方法三：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法三()&#xA;    Dim i, j, k&#xA;    Dim filePath As String, fileAr&#xA;    Dim br(1 To 5000, 1 To 5)&#xA;    filePath = ThisWorkbook.Path &amp;amp; &amp;#34;\表单\&amp;#34;&#xA;    fileAr = filelist(filePath, &amp;#34;*.xlsx&amp;#34;)&#xA;&#xA;    Dim t As Double&#xA;    Dim wb As Workbook&#xA;    Application.ScreenUpdating = False&#xA;&#xA;    t = Timer&#xA;&#xA;    k = 0&#xA;    Dim tmp&#xA;    For i = 1 To UBound(fileAr)&#xA;        k = k + 1&#xA;        For j = 1 To 5&#xA;            br(i, j) = Application.ExecuteExcel4Macro(&amp;#34;&amp;#39;&amp;#34; &amp;amp; filePath &amp;amp; &amp;#34;[&amp;#34; &amp;amp; fileAr(i) &amp;amp; &amp;#34;]信息卡&amp;#39;!&amp;#34; &amp;amp; Range(&amp;#34;c&amp;#34; &amp;amp; j + 4).Address(, , xlR1C1))&#xA;        Next&#xA;    Next i&#xA;    ThisWorkbook.Worksheets(1).[a2].Resize(k, UBound(br, 2)) = br&#xA;    Application.ScreenUpdating = True&#xA;&#xA;    MsgBox Format(Timer - t, &amp;#34;0.000s&amp;#34;)&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485052&amp;amp;idx=1&amp;amp;sn=1459ec753f39116a5682b5b3f558531e&amp;amp;chksm=e8bccf2bdfcb463db93c57b9d87e0bd281a9025543a839ce7762334c2d83bd48cf44a7ec54b1&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例006】数据去重</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B006%E6%95%B0%E6%8D%AE%E5%8E%BB%E9%87%8D.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B006%E6%95%B0%E6%8D%AE%E5%8E%BB%E9%87%8D.html</guid>
				<description>&lt;p&gt;大家好！你是否在为数据去重感到烦恼？&lt;/p&gt;&#xA;&lt;p&gt;今天，我们将分享两种高效的 VBA 方法，帮助你轻松应对数据去重难题。&lt;/p&gt;&#xA;&lt;p&gt;举个例子。&lt;/p&gt;&#xA;&lt;p&gt;我们要对以下数据的产品和型号进行数据去重，保留唯一值。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B006%E3%80%91%E6%95%B0%E6%8D%AE%E5%8E%BB%E9%87%8D.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码，你也可以直接观看下方的视频解析：&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法一()&#xA;    Range(&amp;#34;f1:h18&amp;#34;).RemoveDuplicates Array(1, 2), xlYes&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法二第一次出现的值()&#xA;    Dim i, j, k&#xA;    Dim ar, br()&#xA;&#xA;    ar = Range(&amp;#34;a1:c18&amp;#34;)&#xA;    ReDim br(1 To UBound(ar), 1 To UBound(ar, 2))&#xA;&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;&#xA;    For i = 1 To UBound(ar)&#xA;        kw = ar(i, 1) &amp;amp; ar(i, 2)&#xA;        If Not d.exists(kw) Then&#xA;            k = k + 1&#xA;            For j = 1 To UBound(br, 2)&#xA;                br(k, j) = ar(i, j)&#xA;            Next j&#xA;            d(kw) = &amp;#34;&amp;#34;&#xA;        End If&#xA;    Next i&#xA;&#xA;    [f1].Resize(k, UBound(br, 2)) = br&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二扩展&#34;&gt;方法二：扩展&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法二最后值()&#xA;    Dim i, j, k&#xA;    Dim ar, br()&#xA;&#xA;    ar = Range(&amp;#34;a1:c18&amp;#34;)&#xA;    ReDim br(1 To UBound(ar), 1 To UBound(ar, 2))&#xA;&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;&#xA;    For i = 1 To UBound(ar)&#xA;        kw = ar(i, 1) &amp;amp; ar(i, 2)&#xA;        d(kw) = i&#xA;    Next i&#xA;&#xA;    Dim dickey&#xA;    For Each dickey In d.keys&#xA;        k = k + 1&#xA;        For j = 1 To UBound(br, 2)&#xA;            br(k, j) = ar(d(dickey), j)&#xA;        Next j&#xA;    Next&#xA;&#xA;    [f1].Resize(k, UBound(br, 2)) = br&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485123&amp;amp;idx=1&amp;amp;sn=74578fe8bd5288519db8f509207b0caf&amp;amp;chksm=e8bccf94dfcb468231cb18e7d79f65bd75b01a4636fd0523cb5f36f565447027255b915e52e9&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例007】多条件汇总</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B007%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%B1%87%E6%80%BB.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B007%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%B1%87%E6%80%BB.html</guid>
				<description>&lt;p&gt;大家好！今天回答一位网友的问题。&lt;/p&gt;&#xA;&lt;p&gt;就是用VBA进行多条件汇总，来实现数据透视表的效果，并且要对结果进行排序。&lt;/p&gt;&#xA;&lt;p&gt;先来看例子。&lt;/p&gt;&#xA;&lt;p&gt;假如我们有一份产品信息表，需要对它的所有产品和型号进行汇总。左侧是原始数据，右侧是处理结果。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B007%E3%80%91%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%B1%87%E6%80%BB.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;我们来通过三个不同的方法，来解决这个问题。其中方法一：最容易理解，适合对字典刚入门的情况。方法二：具有有一定的难度，需要对字典有更加深刻的了解。方法三：作为拓展内容。&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码，你也可以直接观看下方的视频解析：&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法一()&#xA;    Dim i, j, k&#xA;    Dim ar&#xA;&#xA;    Dim d1 As Object, d2 As Object, d3 As Object&#xA;    Set d1 = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    Set d2 = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    Set d3 = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;&#xA;    ar = Range(&amp;#34;a1:c&amp;#34; &amp;amp; [a65536].End(3).Row)&#xA;&#xA;    For i = 2 To UBound(ar)&#xA;        d1(ar(i, 1)) = &amp;#34;&amp;#34;&#xA;        d2(ar(i, 2)) = &amp;#34;&amp;#34;&#xA;        d3(ar(i, 1) &amp;amp; ar(i, 2)) = d3(ar(i, 1) &amp;amp; ar(i, 2)) + ar(i, 3)&#xA;    Next i&#xA;&#xA;    [f2].Resize(d1.Count) = Application.WorksheetFunction.Transpose(d1.keys)&#xA;    [g1].Resize(1, d2.Count) = d2.keys&#xA;&#xA;    For i = 1 To d1.Count&#xA;        For j = 1 To d2.Count&#xA;            Cells(i + 1, j + 6) = d3(Cells(i + 1, 6).Value &amp;amp; Cells(1, j + 6).Value)&#xA;        Next j&#xA;    Next i&#xA;&#xA;    &amp;#39;range.Sort&#xA;    Range(&amp;#34;f1&amp;#34;).Resize(d1.Count + 1, d2.Count + 1).Sort [f1], xlAscending, , , , , , xlYes, , , xlTopToBottom&#xA;    Range(&amp;#34;g1&amp;#34;).Resize(d1.Count + 1, d2.Count).Sort [g1], xlAscending, , , , , , , , , xlLeftToRight&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法二()&#xA;    Dim i, j, k&#xA;    Dim ar, br()&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;    ar = Range(&amp;#34;a1:c&amp;#34; &amp;amp; [a65536].End(3).Row)&#xA;&#xA;    ReDim br(1 To UBound(ar), 1 To 1000)&#xA;    Dim rowNum, colNum&#xA;    rowNum = 1: colNum = 1&#xA;    For i = 2 To UBound(ar)&#xA;        &amp;#39;\\型号&#xA;        If Not d.exists(ar(i, 2)) Then&#xA;            colNum = colNum + 1&#xA;            br(1, colNum) = ar(i, 2)&#xA;            d(ar(i, 2)) = colNum&#xA;        End If&#xA;&#xA;        &amp;#39;\\名称&#xA;        If Not d.exists(ar(i, 1)) Then&#xA;            rowNum = rowNum + 1&#xA;            br(rowNum, 1) = ar(i, 1)&#xA;            d(ar(i, 1)) = rowNum&#xA;            br(rowNum, d(ar(i, 2))) = ar(i, 3)&#xA;        Else&#xA;            br(d(ar(i, 1)), d(ar(i, 2))) = br(d(ar(i, 1)), d(ar(i, 2))) + ar(i, 3)&#xA;        End If&#xA;&#xA;    Next i&#xA;&#xA;    [f1].Resize(rowNum, colNum) = br&#xA;    Range(&amp;#34;f1&amp;#34;).Resize(rowNum, colNum).Sort [f1], xlAscending, , , , , , xlYes, , , xlTopToBottom&#xA;    Range(&amp;#34;g1&amp;#34;).Resize(rowNum, colNum - 1).Sort [g1], xlAscending, , , , , , , , , xlLeftToRight&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法三&#34;&gt;方法三：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub SQL查询()&#xA;    &amp;#39;定义变量&#xA;    Dim cnn, rst, SQL$&#xA;    Dim i, j, k&#xA;    Set cnn = CreateObject(&amp;#34;adodb.connection&amp;#34;) &amp;#39;创建数据库连接&#xA;    Set rst = CreateObject(&amp;#34;adodb.recordset&amp;#34;) &amp;#39;创建一个数据集保存数据&#xA;&#xA;    &amp;#39;设置数据库连接&#xA;    If Val(Application.Version) &amp;lt; 12 Then&#xA;        cnn.Open &amp;#34;Provider=Microsoft.Jet.Oledb.4.0;Extended Properties=&amp;#39;Excel 8.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    Else&#xA;        cnn.Open &amp;#34;Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=&amp;#39;Excel 12.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    End If&#xA;&#xA;    &amp;#39;设置SQL语句&#xA;    SQL = &amp;#34;TRANSFORM SUM(数量) SELECT 名称 from [Sheet1$a1:c18] GROUP BY 名称 PIVOT 型号&amp;#34; &amp;#39;&#xA;&#xA;    &amp;#39;SQL结果处理&#xA;    Set rst = cnn.Execute(SQL)&#xA;&#xA;    Range(&amp;#34;f2&amp;#34;).CopyFromRecordset rst&#xA;    For i = 1 To rst.Fields.Count&#xA;        Cells(1, i + 5) = rst.Fields(i - 1).Name&#xA;    Next&#xA;&#xA;    rst.Close&#xA;    cnn.Close &amp;#39;关闭数据库连接&#xA;    Set rst = Nothing&#xA;    Set cnn = Nothing &amp;#39;将cnn从内存中删除&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485136&amp;amp;idx=1&amp;amp;sn=fcc6dd5ad8e974e4b31bea47b811c8b6&amp;amp;chksm=e8bccf87dfcb46912f89badebc8df22ecbec9bc0390633120dbb78e2e28392a310aa9d5401fe&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例008】多条件查询</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B008%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%9F%A5%E8%AF%A2.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B008%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%9F%A5%E8%AF%A2.html</guid>
				<description>&lt;p&gt;大家好！今天分享的案例是多条件查询。&lt;/p&gt;&#xA;&lt;p&gt;这个查询在进销存或者库存管理中特别常用，如果你准备或者正在做一个自己的管理查询工具，这个方法一定要会。先来看一下数据。&lt;/p&gt;&#xA;&lt;p&gt;比如说，现在有一份产品信息表。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B008%E3%80%91%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%9F%A5%E8%AF%A2_1.jpg&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;我们要做的是在查询页面，输入参数后，查询出所有满足条件的内容。其中参数可以不填，不填就表示要查询所有内容。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B008%E3%80%91%E5%A4%9A%E6%9D%A1%E4%BB%B6%E6%9F%A5%E8%AF%A2_2.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;本期将使用2个方法来实现效果，以下是VBA代码，详细视频解析在文末。&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 方法一()&#xA;&#xA;    Dim i, j, k&#xA;    Dim ar, br()&#xA;&#xA;    With Sheet2&#xA;        ar = .Range(&amp;#34;a1:f&amp;#34; &amp;amp; .[a65536].End(3).Row)&#xA;    End With&#xA;&#xA;    ReDim br(1 To UBound(ar), 1 To UBound(ar, 2))&#xA;&#xA;    Dim customer, product, startDate As Date, endDate As Date&#xA;    With Sheet1&#xA;        customer = IIf(.[b2] = &amp;#34;&amp;#34;, &amp;#34;&amp;#34;, &amp;#34;,&amp;#34; &amp;amp; .[b2] &amp;amp; &amp;#34;,&amp;#34;)&#xA;        product = IIf(.[d2] = &amp;#34;&amp;#34;, &amp;#34;&amp;#34;, &amp;#34;,&amp;#34; &amp;amp; .[d2] &amp;amp; &amp;#34;,&amp;#34;)&#xA;        startDate = IIf(.[f2] = &amp;#34;&amp;#34;, #1/1/1900#, .[f2])&#xA;        endDate = IIf(.[h2] = &amp;#34;&amp;#34;, #1/1/2400#, .[h2])&#xA;    End With&#xA;&#xA;    For i = 2 To UBound(ar)&#xA;        If ar(i, 1) &amp;gt;= startDate And ar(i, 1) &amp;lt;= endDate Then&#xA;            If InStr(&amp;#34;,&amp;#34; &amp;amp; ar(i, 2) &amp;amp; &amp;#34;,&amp;#34;, customer) &amp;gt; 0 Then&#xA;                If InStr(&amp;#34;,&amp;#34; &amp;amp; ar(i, 3) &amp;amp; &amp;#34;,&amp;#34;, product) &amp;gt; 0 Then&#xA;                    k = k + 1&#xA;                    For j = 1 To UBound(br, 2)&#xA;                        br(k, j) = ar(i, j)&#xA;                    Next j&#xA;                End If&#xA;            End If&#xA;        End If&#xA;    Next i&#xA;&#xA;    Sheet1.[a5:f65536].ClearContents&#xA;    If k &amp;gt; 0 Then&#xA;        Sheet1.[a5].Resize(k, UBound(br, 2)) = br&#xA;    End If&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub SQL查询()&#xA;    &amp;#39;定义变量&#xA;    Dim cnn, rst, SQL$&#xA;    Dim i, j, k&#xA;    Set cnn = CreateObject(&amp;#34;adodb.connection&amp;#34;) &amp;#39;创建数据库连接&#xA;    Set rst = CreateObject(&amp;#34;adodb.recordset&amp;#34;) &amp;#39;创建一个数据集保存数据&#xA;&#xA;    &amp;#39;设置数据库连接&#xA;    If Val(Application.Version) &amp;lt; 12 Then&#xA;        cnn.Open &amp;#34;Provider=Microsoft.Jet.Oledb.4.0;Extended Properties=&amp;#39;Excel 8.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    Else&#xA;        cnn.Open &amp;#34;Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=&amp;#39;Excel 12.0;HDR=yes&amp;#39;;Data Source=&amp;#34; &amp;amp; ThisWorkbook.FullName&#xA;    End If&#xA;&#xA;    Dim customer, product, startDate As Date, endDate As Date&#xA;    With Sheet1&#xA;        customer = IIf(.[b2] = &amp;#34;&amp;#34;, &amp;#34;&amp;#34;, &amp;#34;,&amp;#34; &amp;amp; .[b2] &amp;amp; &amp;#34;,&amp;#34;)&#xA;        product = IIf(.[d2] = &amp;#34;&amp;#34;, &amp;#34;&amp;#34;, &amp;#34;,&amp;#34; &amp;amp; .[d2] &amp;amp; &amp;#34;,&amp;#34;)&#xA;        startDate = IIf(.[f2] = &amp;#34;&amp;#34;, #1/1/1900#, .[f2])&#xA;        endDate = IIf(.[h2] = &amp;#34;&amp;#34;, #1/1/2400#, .[h2])&#xA;    End With&#xA;&#xA;    &amp;#39;设置SQL语句&#xA;    SQL = &amp;#34;select * from [产品信息$A1:F22] where 日期&amp;gt;=#&amp;#34; &amp;amp; startDate &amp;amp; &amp;#34;# and 日期&amp;lt;=#&amp;#34; &amp;amp; endDate &amp;amp; &amp;#34;# and instr(&amp;#39;,&amp;#39;&amp;amp;客户&amp;amp;&amp;#39;,&amp;#39;,&amp;#39;&amp;#34; &amp;amp; customer &amp;amp; &amp;#34;&amp;#39;)&amp;gt;0 and instr(&amp;#39;,&amp;#39;&amp;amp;产品&amp;amp;&amp;#39;,&amp;#39;,&amp;#39;&amp;#34; &amp;amp; product &amp;amp; &amp;#34;&amp;#39;)&amp;gt;0&amp;#34; &amp;#39;&#xA;&#xA;    &amp;#39;SQL结果处理&#xA;    Set rst = cnn.Execute(SQL)&#xA;&#xA;    Sheet1.[a5:f65536].ClearContents&#xA;    Sheet1.Range(&amp;#34;a5&amp;#34;).CopyFromRecordset rst&#xA;&amp;#39;    For i = 1 To rst.Fields.Count&#xA;&amp;#39;        Cells(1, i + 5) = rst.Fields(i - 1).Name&#xA;&amp;#39;    Next&#xA;&#xA;    rst.Close&#xA;    cnn.Close &amp;#39;关闭数据库连接&#xA;    Set rst = Nothing&#xA;    Set cnn = Nothing &amp;#39;将cnn从内存中删除&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485165&amp;amp;idx=1&amp;amp;sn=db0537ef59d97d88e01ce1fffdb64ede&amp;amp;chksm=e8bccfbadfcb46acfd719e6ecdd36faf6e914abf46752426d49e7de49ac627a31036befdb81b&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例009】合并单元格汇总</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B009%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC%E6%B1%87%E6%80%BB.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B009%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC%E6%B1%87%E6%80%BB.html</guid>
				<description>&lt;p&gt;大家好！今天分享一下遇到合并单元格的处理思路。&lt;/p&gt;&#xA;&lt;p&gt;工作中，为了方便查看数据，很多朋友习惯性的把单元格合并起来，这样使得表格看起来清晰美观了不少。但这样做的同时，会给以后的计算增加很多困难。&lt;/p&gt;&#xA;&lt;p&gt;比如下边：要计算产品的总库存。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B009%E3%80%91%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC%E6%B1%87%E6%80%BB.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;当我们要对合并单元格进行汇总统计的时候，总会遇到很多问题。其实只要你明白合并单元格的底层逻辑之后，问题就会变的简单起来。&lt;/p&gt;&#xA;&lt;p&gt;合并单元格：其实只保留了区域左上角的一个值，其他位置都是空的。&lt;/p&gt;&#xA;&lt;p&gt;明白原理之后，我们再来看下VBA代码，详细解析请看文末视频。&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 汇总()&#xA;&#xA;    Dim i, j, k&#xA;    Dim ar&#xA;&#xA;    ar = Range(&amp;#34;a1:c&amp;#34; &amp;amp; [c65536].End(3).Row)&#xA;&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;&#xA;    For i = 2 To UBound(ar)&#xA;        If ar(i, 1) = &amp;#34;&amp;#34; Then ar(i, 1) = ar(i - 1, 1)&#xA;        d(ar(i, 1)) = d(ar(i, 1)) + ar(i, 3)&#xA;    Next&#xA;    [F2].Resize(d.Count) = Application.WorksheetFunction.Transpose(d.keys)&#xA;    [g2].Resize(d.Count) = Application.WorksheetFunction.Transpose(d.items)&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485175&amp;amp;idx=1&amp;amp;sn=21a86379e469df4052c9e26bc5615e4b&amp;amp;chksm=e8bccfa0dfcb46b67aa9719e78f9d5ef4e2316ead39351e037282d360f6fc752126496c0e063&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例010】下拉多选</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B010%E4%B8%8B%E6%8B%89%E5%A4%9A%E9%80%89.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B010%E4%B8%8B%E6%8B%89%E5%A4%9A%E9%80%89.html</guid>
				<description>&lt;p&gt;大家好！今天将为大家介绍在Excel中如何实现下拉多选功能，让数据输入更加灵活高效。&lt;/p&gt;&#xA;&lt;p&gt;下拉多选功能不仅提高了数据输入的灵活性，还减少了输入错误的可能性，为我们的数据处理工作带来了更高的效率。&lt;/p&gt;&#xA;&lt;p&gt;也许你见过使用表单控件的方式实现下拉多选，但是通过数据验证和VBA，我们同样能够轻松创建具有下拉多选功能的工作表。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B010%E3%80%91%E4%B8%8B%E6%8B%89%E5%A4%9A%E9%80%89.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码，详细解析请看文末视频。&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Private Sub Worksheet_Change(ByVal Target As Range)&#xA;&#xA;    Dim rngDV As Range&#xA;    Dim oldVal As String&#xA;    Dim newVal As String&#xA;    Dim fenGeFu As String&#xA;&#xA;    If Target.CountLarge &amp;gt; 1 Then Exit Sub&#xA;    fenGeFu = &amp;#34;,&amp;#34; &amp;#39;规定用逗号分隔&#xA;&#xA;    On Error Resume Next&#xA;    Set rngDV = Cells.SpecialCells(xlCellTypeAllValidation)&#xA;&#xA;    If rngDV Is Nothing Then Exit Sub&#xA;    If Intersect(Target, rngDV) Is Nothing Then Exit Sub&#xA;&#xA;    Application.EnableEvents = False&#xA;    newVal = Target.Value&#xA;    Application.Undo&#xA;    oldVal = Target.Value&#xA;    Target.Value = newVal&#xA;&#xA;    If oldVal &amp;lt;&amp;gt; &amp;#34;&amp;#34; Then&#xA;        If newVal &amp;lt;&amp;gt; &amp;#34;&amp;#34; Then&#xA;            If InStr(fenGeFu &amp;amp; oldVal &amp;amp; fenGeFu, fenGeFu &amp;amp; newVal &amp;amp; fenGeFu) &amp;gt; 0 Then&#xA;                If InStrRev(oldVal, newVal) + Len(newVal) - 1 = Len(oldVal) Then&#xA;                    Target.Value = Replace(oldVal, fenGeFu &amp;amp; newVal, &amp;#34;&amp;#34;)&#xA;                Else&#xA;                    Target.Value = Replace(oldVal, newVal &amp;amp; fenGeFu, &amp;#34;&amp;#34;)&#xA;                End If&#xA;            Else&#xA;                Target.Value = oldVal &amp;amp; fenGeFu &amp;amp; newVal&#xA;            End If&#xA;        End If&#xA;    End If&#xA;&#xA;    Application.EnableEvents = True&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485185&amp;amp;idx=1&amp;amp;sn=b5dc7e560d9ac9504265d18a7d949286&amp;amp;chksm=e8bcce56dfcb47405814a13e1a7ed65403775118f663853c2c5cd920fd4ed242ad7fccf925ff&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例011】合并工作表</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B011%E5%90%88%E5%B9%B6%E5%B7%A5%E4%BD%9C%E8%A1%A8.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B011%E5%90%88%E5%B9%B6%E5%B7%A5%E4%BD%9C%E8%A1%A8.html</guid>
				<description>&lt;p&gt;大家好！终于放假了，知了祝大家双节快乐！~&lt;/p&gt;&#xA;&lt;p&gt;今天分享的案例非常的经典，它让我首次见识了VBA的魅力。也是从那会儿开始，命运的齿轮开始转动，走上了学习VBA的道路。&lt;/p&gt;&#xA;&lt;p&gt;它就是：合并工作表。&lt;/p&gt;&#xA;&lt;p&gt;问题很简单：就是把一个工作簿里的所有sheet合并到一个总表里边。&lt;/p&gt;&#xA;&lt;p&gt;如下图：将 4个班级的信息合并。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B011%E3%80%91%E5%90%88%E5%B9%B6%E5%B7%A5%E4%BD%9C%E8%A1%A8.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码（长按复制，可向右托动），详细解析请看文末视频。&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一复制粘贴&#34;&gt;方法一：复制粘贴&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 复制粘贴()&#xA;&#xA;    Dim sht As Worksheet&#xA;    Dim zongSht As Worksheet&#xA;&#xA;    Set zongSht = Worksheets(&amp;#34;总表&amp;#34;)&#xA;&#xA;    Dim rowsCount, zongRows&#xA;    For Each sht In Worksheets&#xA;        If sht.Name &amp;lt;&amp;gt; &amp;#34;总表&amp;#34; Then&#xA;            With sht&#xA;                rowsCount = .[a65536].End(3).Row&#xA;                zongRows = zongSht.[a65536].End(3).Row + 1&#xA;                .Range(&amp;#34;a2:d&amp;#34; &amp;amp; rowsCount).Copy zongSht.Range(&amp;#34;a&amp;#34; &amp;amp; zongRows)&#xA;            End With&#xA;        End If&#xA;    Next&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二数组&#34;&gt;方法二：数组&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 数组()&#xA;&#xA;    Dim sht As Worksheet&#xA;    Dim zongSht As Worksheet&#xA;&#xA;    Set zongSht = Worksheets(&amp;#34;总表&amp;#34;)&#xA;&#xA;    Dim rowsCount, zongRows&#xA;    Dim tmpAr&#xA;    For Each sht In Worksheets&#xA;        If sht.Name &amp;lt;&amp;gt; &amp;#34;总表&amp;#34; Then&#xA;            With sht&#xA;                rowsCount = .[a65536].End(3).Row&#xA;                zongRows = zongSht.[a65536].End(3).Row + 1&#xA;                tmpAr = .Range(&amp;#34;a2:d&amp;#34; &amp;amp; rowsCount)&#xA;                zongSht.Range(&amp;#34;a&amp;#34; &amp;amp; zongRows).Resize(UBound(tmpAr), UBound(tmpAr, 2)) = tmpAr&#xA;            End With&#xA;        End If&#xA;    Next&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485203&amp;amp;idx=1&amp;amp;sn=c64987b006f9b38f49d0878e102b01bc&amp;amp;chksm=e8bcce44dfcb4752782767f464205bccc84b743f39e8a6f8988ae79067c61e85130dbc91aa55&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例012】合并工作簿</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B012%E5%90%88%E5%B9%B6%E5%B7%A5%E4%BD%9C%E7%B0%BF.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B012%E5%90%88%E5%B9%B6%E5%B7%A5%E4%BD%9C%E7%B0%BF.html</guid>
				<description>&lt;p&gt;大家好！这次分享的是非常经典的案例：合并工作簿。&lt;/p&gt;&#xA;&lt;p&gt;相信大家已经很熟悉这个问题了，就是把多个工作簿里的工作表合并到同一个sheet里。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B012%E3%80%91%E5%90%88%E5%B9%B6%E5%B7%A5%E4%BD%9C%E7%B0%BF_1.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B012%E3%80%91%E5%90%88%E5%B9%B6%E5%B7%A5%E4%BD%9C%E7%B0%BF_2.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;这次同样分享两个方法，以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;p&gt;自定义函数：&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Private Function filelist(folderspec, Optional pstr = &amp;#34;*.txt&amp;#34;)&#xA;    On Error GoTo errline&#xA;    Dim fs, f, f1, fc, i, farr&#xA;    Set fs = CreateObject(&amp;#34;Scripting.FileSystemObject&amp;#34;)&#xA;    Set f = fs.GetFolder(folderspec)&#xA;    Set fc = f.Files&#xA;    ReDim farr(1 To fc.Count)&#xA;    For Each f1 In fc&#xA;        If f1.Name Like pstr And Not f1.Name Like &amp;#34;*~$*&amp;#34; Then&#xA;            i = i + 1&#xA;            farr(i) = f1.Name&#xA;        End If&#xA;    Next&#xA;    ReDim Preserve farr(1 To i)&#xA;    filelist = farr&#xA;errline:&#xA;End Function&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法一复制粘贴&#34;&gt;方法一：复制粘贴&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 复制粘贴()&#xA;&#xA;    Dim i, j, k&#xA;    Dim fileAr&#xA;&#xA;    fileAr = filelist(ThisWorkbook.Path &amp;amp; &amp;#34;\文件夹\&amp;#34;, &amp;#34;*.xlsx&amp;#34;)&#xA;&#xA;    Application.ScreenUpdating = False&#xA;    For i = 1 To UBound(fileAr)&#xA;        With Workbooks.Open(ThisWorkbook.Path &amp;amp; &amp;#34;\文件夹\&amp;#34; &amp;amp; fileAr(i))&#xA;            With .Sheets(1)&#xA;                .Range(&amp;#34;a2:e&amp;#34; &amp;amp; .[a65536].End(3).Row).Copy Sheet1.Range(&amp;#34;a&amp;#34; &amp;amp; Sheet1.[a65536].End(3).Row + 1)&#xA;            End With&#xA;            .Close False&#xA;        End With&#xA;    Next i&#xA;    Application.ScreenUpdating = True&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二数组&#34;&gt;方法二：数组&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 数组()&#xA;&#xA;    Dim i, j, k&#xA;    Dim fileAr&#xA;&#xA;    fileAr = filelist(ThisWorkbook.Path &amp;amp; &amp;#34;\文件夹\&amp;#34;, &amp;#34;*.xlsx&amp;#34;)&#xA;&#xA;    Dim tmp&#xA;    Application.ScreenUpdating = False&#xA;    For i = 1 To UBound(fileAr)&#xA;        With Workbooks.Open(ThisWorkbook.Path &amp;amp; &amp;#34;\文件夹\&amp;#34; &amp;amp; fileAr(i))&#xA;            With .Sheets(1)&#xA;                tmp = .Range(&amp;#34;a2:e&amp;#34; &amp;amp; .[a65536].End(3).Row)&#xA;                Sheet1.Range(&amp;#34;a&amp;#34; &amp;amp; Sheet1.[a65536].End(3).Row + 1).Resize(UBound(tmp), UBound(tmp, 2)) = tmp&#xA;            End With&#xA;            .Close False&#xA;        End With&#xA;    Next i&#xA;    Application.ScreenUpdating = True&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485223&amp;amp;idx=1&amp;amp;sn=40015e3160260dc67f98668769a745dc&amp;amp;chksm=e8bcce70dfcb47667654536773ea062c2f7eabad314ade51fa33e34e899a4b17770de329e6ac&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例013】多个工作簿所有Sheet汇总到一个工作簿中</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B013%E5%A4%9A%E4%B8%AA%E5%B7%A5%E4%BD%9C%E7%B0%BF%E6%89%80%E6%9C%89sheet%E6%B1%87%E6%80%BB%E5%88%B0%E4%B8%80%E4%B8%AA%E5%B7%A5%E4%BD%9C%E7%B0%BF%E4%B8%AD.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B013%E5%A4%9A%E4%B8%AA%E5%B7%A5%E4%BD%9C%E7%B0%BF%E6%89%80%E6%9C%89sheet%E6%B1%87%E6%80%BB%E5%88%B0%E4%B8%80%E4%B8%AA%E5%B7%A5%E4%BD%9C%E7%B0%BF%E4%B8%AD.html</guid>
				<description>&lt;p&gt;大家好！昨天视频放错了，今天重新发一下。图片&lt;/p&gt;&#xA;&lt;p&gt;这次分享的是合并系列的最后一个案例：汇总工作簿。&lt;/p&gt;&#xA;&lt;p&gt;打个比方：把多个工作簿中的每个Sheet，汇总到一个工作簿里，汇总完之后是所有的Sheet都在同一个工作簿里。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B013%E3%80%91%E5%A4%9A%E4%B8%AA%E5%B7%A5%E4%BD%9C%E7%B0%BF%E6%89%80%E6%9C%89Sheet%E6%B1%87%E6%80%BB%E5%88%B0%E4%B8%80%E4%B8%AA%E5%B7%A5%E4%BD%9C%E7%B0%BF%E4%B8%AD.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;这次使用了Dir函数，以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;p&gt;&amp;lsquo;Dir函数：返回的是指定路径下【文件】或者【文件夹】的名称。如果不存在，就返回 &amp;quot;&amp;quot; 字符串&#xA;&amp;lsquo;Dir 函数一般搭配 do while 循环遍历文件，结束的条件就是Dir返回空值。&lt;/p&gt;&#xA;&lt;p&gt;&amp;lsquo;举例：&#xA;&amp;lsquo;fileName1 = Dir(&amp;ldquo;E:\test*.xlsx&amp;rdquo;)  查找E盘test文件夹里边的xlsx工作簿，将第一个工作簿名称返回&#xA;&amp;lsquo;fileName2 = Dir                    查找下一个，并且不需要写参数&#xA;&amp;lsquo;fileName3 = Dir                    查找下一个，并且不需要写参数&#xA;&amp;lsquo;fileName4 = Dir                    查找下一个，并且不需要写参数&#xA;&amp;lsquo;&amp;hellip;&amp;hellip;                           &amp;hellip;&amp;hellip;&#xA;&amp;lsquo;当返回 &amp;quot;&amp;quot; 的时候说明查找完了。如果直接 fileName_N = Dir 就会报错，需要重新指定参数&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 汇总工作簿()&#xA;&#xA;    Dim filePath, fileName&#xA;    Dim sht As Worksheet&#xA;&#xA;    filePath = ThisWorkbook.Path &amp;amp; &amp;#34;\文件夹\&amp;#34;&#xA;&#xA;    fileName = Dir(filePath &amp;amp; &amp;#34;*.xlsx&amp;#34;)&#xA;&#xA;    Application.ScreenUpdating = False&#xA;    Do While fileName &amp;lt;&amp;gt; &amp;#34;&amp;#34;&#xA;        With Workbooks.Open(filePath &amp;amp; fileName)&#xA;            For Each sht In .Worksheets&#xA;                sht.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)&#xA;                ActiveSheet.Name = sht.Name &amp;amp; &amp;#34;-&amp;#34; &amp;amp; Replace(.Name, &amp;#34;.xlsx&amp;#34;, &amp;#34;&amp;#34;)&#xA;            Next&#xA;            .Close False&#xA;        End With&#xA;        fileName = Dir&#xA;    Loop&#xA;    Application.ScreenUpdating = True&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485233&amp;amp;idx=1&amp;amp;sn=a27892d151b9a8332f01f20be6e0f7f9&amp;amp;chksm=e8bcce66dfcb4770c956e41db7a9d08d9fc1e153cd3cf7681b0130d12be97b7908d27d53a0e8&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例014】拆分工作表（上）</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B014%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E8%A1%A8%E4%B8%8A.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B014%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E8%A1%A8%E4%B8%8A.html</guid>
				<description>&lt;p&gt;大家好！如何按照表中的某一列，拆分成独立的Sheet? 如下：&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B014%E3%80%91%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E8%A1%A8%EF%BC%88%E4%B8%8A%EF%BC%89.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;这是一个特别常见常用的问题，本期分享本人用的最多的两个方法中的第一个。&lt;/p&gt;&#xA;&lt;p&gt;因为确实不太容易理解，所以分为两部分。&lt;/p&gt;&#xA;&lt;p&gt;这个方法非常的实用，在其他地方也可以发挥很大的作用，所以墙裂推荐大家掌握！&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 数组装进字典()&#xA;    Dim i, j, k&#xA;    Dim ar, tmp()&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;&#xA;    ar = Range(&amp;#34;a1:e&amp;#34; &amp;amp; [a65536].End(3).Row)&#xA;    Dim irow&#xA;    For i = 2 To UBound(ar)&#xA;        kw = ar(i, 4)&#xA;        If Not d.exists(kw) Then&#xA;            ReDim tmp(1 To 5000, 1 To UBound(ar, 2) + 1)&#xA;            For j = 1 To UBound(ar, 2)&#xA;                tmp(1, j) = ar(1, j)&#xA;                tmp(2, j) = ar(i, j)&#xA;            Next&#xA;            tmp(1, UBound(ar, 2) + 1) = 2&#xA;            d(kw) = tmp&#xA;        Else&#xA;            tmp = d(kw)&#xA;            irow = tmp(1, UBound(ar, 2) + 1) + 1&#xA;            For j = 1 To UBound(ar, 2)&#xA;                tmp(irow, j) = ar(i, j)&#xA;            Next&#xA;            tmp(1, UBound(ar, 2) + 1) = irow&#xA;            d(kw) = tmp&#xA;        End If&#xA;    Next i&#xA;&#xA;    Dim dk&#xA;    For Each dk In d.keys&#xA;        With ThisWorkbook.Worksheets.Add(after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count))&#xA;            .Name = dk&#xA;            tmp = d(dk)&#xA;            .[a1].Resize(tmp(1, UBound(ar, 2) + 1), UBound(ar, 2)) = tmp&#xA;        End With&#xA;    Next&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485240&amp;amp;idx=1&amp;amp;sn=4fb6d29d247c9738f7c8c2ad5041c54c&amp;amp;chksm=e8bcce6fdfcb47790d046fc09014a1e28640e51b51b4f5492888e5fd1672c27fa4628698119b&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例015】拆分工作表（下）</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B015%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E8%A1%A8%E4%B8%8B.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B015%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E8%A1%A8%E4%B8%8B.html</guid>
				<description>&lt;p&gt;大家好！书接上文，继续聊一聊拆分工作表的第二个方法。&lt;/p&gt;&#xA;&lt;p&gt;众所周知，字典中的值不仅可以是数字、字符串，还可以是数组和对象！&lt;/p&gt;&#xA;&lt;p&gt;上一个方法是将数组装到了字典里，这第二个方法想必大家已经猜到了，就是把对象装进字典里。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B015%E3%80%91%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E8%A1%A8%EF%BC%88%E4%B8%8B%EF%BC%89.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;首先简单介绍一下Union函数的使用方法。Union：返回两个或多个区域的合并区域。&lt;/p&gt;&#xA;&lt;p&gt;语法：&#xA;Union(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9, Arg10, Arg11, Arg12, Arg13, Arg14, Arg15, Arg16, Arg17, Arg18, Arg19, Arg20, Arg21, Arg22, Arg23, Arg24, Arg25, Arg26, Arg27, Arg28, Arg29, Arg30) AS Range&#xA;参数：&#xA;Arg1 必需 Range类型。&#xA;Arg2 必需 Range类型。&#xA;Arg3– Arg30 可选 Variant类型。&#xA;返回：&#xA;Range类型。&#xA;另外一点需要强调的是，VBA中给对象变量赋值使用Set，并且Set不能省略。&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub range装进字典()&#xA;    Dim i, j, k&#xA;    Dim ar, tmp()&#xA;    Dim d As Object, kw$&#xA;    Set d = CreateObject(&amp;#34;Scripting.Dictionary&amp;#34;)&#xA;    &amp;#39;d.CompareMode = vbTextCompare &amp;#39;不区分大小写&#xA;&#xA;    ar = Range(&amp;#34;a1:e&amp;#34; &amp;amp; [a65536].End(3).Row)&#xA;    Dim irow&#xA;    For i = 2 To UBound(ar)&#xA;        kw = ar(i, 4)&#xA;        If Not d.exists(kw) Then&#xA;            Set d(kw) = Union(Range(&amp;#34;a1:e1&amp;#34;), Range(&amp;#34;a&amp;#34; &amp;amp; i &amp;amp; &amp;#34;:e&amp;#34; &amp;amp; i))&#xA;        Else&#xA;            Set d(kw) = Union(d(kw), Range(&amp;#34;a&amp;#34; &amp;amp; i &amp;amp; &amp;#34;:e&amp;#34; &amp;amp; i))&#xA;        End If&#xA;    Next i&#xA;&#xA;    Dim dk&#xA;    For Each dk In d.keys&#xA;        With ThisWorkbook.Worksheets.Add(after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count))&#xA;            .Name = dk&#xA;            d(dk).Copy .[a1]&#xA;        End With&#xA;    Next&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485249&amp;amp;idx=1&amp;amp;sn=a5358d8fe595364149e6f41e84cdec3b&amp;amp;chksm=e8bcce16dfcb47004200062e717b1f72ba0326d94589d37bdfad489431f3e72491eb119824a8&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例016】拆分工作簿</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B016%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E7%B0%BF.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B016%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E7%B0%BF.html</guid>
				<description>&lt;p&gt;大家好！&lt;/p&gt;&#xA;&lt;p&gt;通过本次和之前几次的分享。对工作表、工作簿的拆分、合并都做了最基础的介绍以及案例演示。&lt;/p&gt;&#xA;&lt;p&gt;而面对实际工作中经常遇到的工作表、工作簿的合并拆分问题，相信大家通过对这几个案例的交汇融合，基本上都可以找到对应的解决方案。&lt;/p&gt;&#xA;&lt;p&gt;今天分享的是拆分系列的最有一项内容：拆分工作簿。就是把一个工作簿中的所有Sheet拆分成一个一个的独立的工作簿。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B016%E3%80%91%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E7%B0%BF_1.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;通过今天的案例，你将掌握工作表对象的Move和Copy方法。听起来很陌生，其实是你经常在用的一个很普通的功能：&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B016%E3%80%91%E6%8B%86%E5%88%86%E5%B7%A5%E4%BD%9C%E7%B0%BF_2.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;语法：&#xA;Sheet.Copy([Before],[After])&amp;lsquo;参数可选，非必须&#xA;Sheet.Move([Before],[After])&amp;lsquo;参数可选，非必须&#xA;注意：&#xA;如果不填参数，将会把Sheet移动或复制到一个新的工作簿中&#xA;以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Option Explicit&#xA;&#xA;Sub 拆分工作簿()&#xA;&#xA;    Dim sht As Worksheet&#xA;    Dim filePath&#xA;&#xA;    filePath = ThisWorkbook.Path &amp;amp; &amp;#34;\&amp;#34;&#xA;&#xA;    Application.ScreenUpdating = False&#xA;    For Each sht In ThisWorkbook.Worksheets&#xA;        If sht.Name &amp;lt;&amp;gt; &amp;#34;首页&amp;#34; Then&#xA;            &amp;#39;sht.Move&#xA;            sht.Copy&#xA;            ActiveWorkbook.SaveAs filePath &amp;amp; sht.Name &amp;amp; &amp;#34;.xlsx&amp;#34;&#xA;            ActiveWorkbook.Close&#xA;        End If&#xA;    Next&#xA;    Application.ScreenUpdating = True&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485257&amp;amp;idx=1&amp;amp;sn=1ab601287ccfb83c25899c5cbc734433&amp;amp;chksm=e8bcce1edfcb4708aefdfa5f75ae9cf5f1a6a37466cf0dbeb75dc10bf286c2ba57a3e10ddf38&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例017】合并单元格</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B017%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B017%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC.html</guid>
				<description>&lt;p&gt;大家好！&lt;/p&gt;&#xA;&lt;p&gt;合并单元格是经常遇到的操作，在WPS中，提供了非常好用的快捷按钮。遗憾的是Excel里并没有这个一键合并单元格的功能。&lt;/p&gt;&#xA;&lt;p&gt;今天分享用VBA合并单元格的两个最常用的方法，如果你是WPS用户，虽然不需要代码，但是编程的思路，还是有参考价值的。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B017%E3%80%91%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub union并集函数()&#xA;&#xA;    Dim i&#xA;    Dim rng As Range&#xA;&#xA;    Set rng = [a2]&#xA;&#xA;    Application.DisplayAlerts = False&#xA;    For i = 2 To 20&#xA;        If Range(&amp;#34;a&amp;#34; &amp;amp; i + 1) = Range(&amp;#34;a&amp;#34; &amp;amp; i) Then&#xA;            Set rng = Union(rng, Range(&amp;#34;a&amp;#34; &amp;amp; i + 1))&#xA;        Else&#xA;            rng.Merge&#xA;            Set rng = Range(&amp;#34;a&amp;#34; &amp;amp; i + 1)&#xA;        End If&#xA;    Next i&#xA;    Application.DisplayAlerts = True&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 循环数组()&#xA;&#xA;    Dim i, j, ar&#xA;    Dim start_row, end_row&#xA;&#xA;    ar = [a1:a20]&#xA;    start_row = 2&#xA;&#xA;    Application.DisplayAlerts = False&#xA;    For i = 2 To UBound(ar)&#xA;        For j = i + 1 To UBound(ar)&#xA;            If ar(j, 1) = ar(i, 1) Then&#xA;                end_row = j&#xA;            Else&#xA;                end_row = j - 1&#xA;                Exit For&#xA;            End If&#xA;        Next j&#xA;        Range(&amp;#34;a&amp;#34; &amp;amp; start_row &amp;amp; &amp;#34;:a&amp;#34; &amp;amp; end_row).Merge&#xA;        start_row = j&#xA;        i = start_row - 1&#xA;    Next i&#xA;    Application.DisplayAlerts = True&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485264&amp;amp;idx=1&amp;amp;sn=6307b2628df616ca9d0e4246b1e32d7a&amp;amp;chksm=e8bcce07dfcb4711cce31a831ada9b655400d1e573b0d8e57c70fcfafbaec6efde3d9bb9a2f8&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例018】取消合并单元格</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B018%E5%8F%96%E6%B6%88%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B018%E5%8F%96%E6%B6%88%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC.html</guid>
				<description>&lt;p&gt;大家好！&lt;/p&gt;&#xA;&lt;p&gt;上一篇内容分享了，用VBA合并单元格的两个方法。本期就来看一下如何取消合并的单元格。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B018%E3%80%91%E5%8F%96%E6%B6%88%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;同样的，WPS内置了一键取消合并单元格并填充内容的功能，而Excel用户只能流下羡慕的泪水。&lt;/p&gt;&#xA;&lt;p&gt;这次介绍两个方法，来实现和WPS一模一样的功能。&lt;/p&gt;&#xA;&lt;p&gt;第一个方法：使用录制宏的操作，把平时手动取消合并的操作记录下来，并对代码加以修改，来达到目的。第二个方法：使用的循环单元格判断是否合并的方法，其中有几个常用的属性是我们必须要了解掌握的。&lt;/p&gt;&#xA;&lt;p&gt;两个方法都比较简单。大家可以根据实际情况，酌情选择适用的方法。&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;h2 id=&#34;方法一&#34;&gt;方法一：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 宏2()&#xA;&#xA;    Range(&amp;#34;a1:a20&amp;#34;).UnMerge&#xA;    Range(&amp;#34;a1:a20&amp;#34;).SpecialCells(xlCellTypeBlanks).FormulaR1C1 = &amp;#34;=R[-1]C&amp;#34;&#xA;    Range(&amp;#34;a1:a20&amp;#34;).Value = Range(&amp;#34;a1:a20&amp;#34;).Value&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;h2 id=&#34;方法二&#34;&gt;方法二：&lt;/h2&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 取消合并单元格()&#xA;&#xA;    Dim cel As Range&#xA;    Dim mRng As Range&#xA;    Dim mRngVal&#xA;&#xA;    For Each cel In Range(&amp;#34;a1:a20&amp;#34;)&#xA;        If cel.MergeCells Then&#xA;            Set mRng = cel.MergeArea&#xA;            mRngVal = mRng(1, 1)&#xA;            mRng.UnMerge&#xA;            mRng.Value = mRngVal&#xA;        End If&#xA;    Next&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485272&amp;amp;idx=1&amp;amp;sn=898b64ffdb77aff339d71f7bda45906f&amp;amp;chksm=e8bcce0fdfcb47192a223e90ac62cd0b104af662e8f66c26dfdc87801f61712a960f6777470c&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例019】合并单元格自适应大小</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B019%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC%E8%87%AA%E9%80%82%E5%BA%94%E5%A4%A7%E5%B0%8F.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B019%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC%E8%87%AA%E9%80%82%E5%BA%94%E5%A4%A7%E5%B0%8F.html</guid>
				<description>&lt;p&gt;大家好！&lt;/p&gt;&#xA;&lt;p&gt;如果你是文职类工作，可能会遇到下面这种情况：&lt;/p&gt;&#xA;&lt;p&gt;经常面对各种各样的表格，并且很多都是制式的，里边又充满个各种各样的格式，其中就有今天的主角儿：合并单元格。&lt;/p&gt;&#xA;&lt;p&gt;而你的工作看似也不复杂，就是把合并单元格中显示不全的内容，通过调整单元格的大小来显示出来。&lt;/p&gt;&#xA;&lt;p&gt;这种痛苦，只有手动调整过的人能懂。&lt;/p&gt;&#xA;&lt;p&gt;所以，通过今天的案例讲解，将解决你的烦恼，文末视频对这个过程做了详细的讲解演示，希望对你有帮助。&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B019%E3%80%91%E5%90%88%E5%B9%B6%E5%8D%95%E5%85%83%E6%A0%BC%E8%87%AA%E9%80%82%E5%BA%94%E5%A4%A7%E5%B0%8F.gif&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;p&gt;调整合并单元格行高：&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Sub 调整合并单元格行高()&#xA;    Dim cel As Range&#xA;    Dim rng As Range&#xA;    Dim n, r, c&#xA;    Dim mergeWidth, newHeight, celWidth&#xA;&#xA;    Set rng = Range(&amp;#34;B4&amp;#34;)&#xA;    For Each cel In rng&#xA;        If cel.MergeCells Then&#xA;            With cel.MergeArea&#xA;                mergeWidth = 0&#xA;                For Each c In .Columns &amp;#39;合并区域中的每一个单元格&#xA;                    mergeWidth = mergeWidth + c.ColumnWidth &amp;#39;新合并区域列宽=每一列列宽宽的和&#xA;                Next&#xA;&#xA;                .MergeCells = False &amp;#39;取消合并单元格&#xA;&#xA;                With .Cells(1)&#xA;                    .WrapText = True &amp;#39;自动换行&#xA;                    celWidth = .ColumnWidth &amp;#39;记录取消合并后列宽，目的是调整回去&#xA;                    .ColumnWidth = mergeWidth &amp;#39;调整第一个单元格宽度&#xA;                    .EntireRow.AutoFit &amp;#39;自适应大小&#xA;                    newHeight = .RowHeight &amp;#39;记录此时的行高，即合并后新的行高&#xA;                    .ColumnWidth = celWidth &amp;#39;调整回原始列宽&#xA;                End With&#xA;&#xA;                .MergeCells = True &amp;#39;合并单元格&#xA;&#xA;                n = .Rows.Count&#xA;                For Each r In .Rows&#xA;                    r.RowHeight = newHeight / n * 1.1 &amp;#39;调整每一行的行高，并*1.1微调&#xA;                Next&#xA;                .HorizontalAlignment = xlCenter &amp;#39;左右居中&#xA;                .VerticalAlignment = xlCenter &amp;#39;&amp;#39;上下居中&#xA;            End With&#xA;        End If&#xA;    Next&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;调整合并单元格列宽：&lt;/p&gt;</description>
			</item>
			<item>
				<title>【VBA案例020】整合工作簿</title>
				<link>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B020%E6%95%B4%E5%90%88%E5%B7%A5%E4%BD%9C%E7%B0%BF.html</link>
				<pubDate>Mon, 23 Oct 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/vba%E6%A1%88%E4%BE%8B020%E6%95%B4%E5%90%88%E5%B7%A5%E4%BD%9C%E7%B0%BF.html</guid>
				<description>&lt;p&gt;大家好！今天回答一位粉丝朋友的提问。&lt;/p&gt;&#xA;&lt;p&gt;问题是：将多个工作簿中的所有工作表合并汇总，要求名称相同的工作表内容要合并在一起，名称不同的要单独作为一个工作表。&lt;/p&gt;&#xA;&lt;p&gt;为此，我模拟了一份数据，结构如下图：&lt;/p&gt;&#xA;&lt;p&gt;&lt;img src=&#34;https://img.richfan.site/program/vba/vba%E6%A1%88%E5%88%97/%E3%80%90VBA%E6%A1%88%E4%BE%8B020%E3%80%91%E6%95%B4%E5%90%88%E5%B7%A5%E4%BD%9C%E7%B0%BF.png&#34; alt=&#34;&#34;&gt;&lt;/p&gt;&#xA;&lt;p&gt;这个问题，其实是我之前分享的【案例011合并工作表】和【案例013汇总工作簿】的融合版。方法非常的相似。其实对于工作簿和工作表的合并与拆分的操作，之前的案例基本都分享完了。只要融会贯通，举一反三，相信这种问题将迎刃而解。&lt;/p&gt;&#xA;&lt;p&gt;效果就不演示了，以下是VBA代码。详细解析请看文末的视频。&lt;/p&gt;&#xA;&lt;figure class=&#34;code-block&#34; data-code-block data-language=&#34;vb&#34;&gt;&#xA;  &lt;figcaption class=&#34;code-block__toolbar&#34;&gt;&#xA;    &lt;span class=&#34;code-block__language&#34;&gt;vb&lt;/span&gt;&#xA;      &lt;button class=&#34;code-block__copy&#34; type=&#34;button&#34; data-code-copy&gt;复制&lt;/button&gt;&#xA;  &lt;/figcaption&gt;&#xA;  &lt;div class=&#34;code-block__viewport&#34;&gt;&#xA;    &lt;pre class=&#34;code-block__fallback&#34; tabindex=&#34;0&#34;&gt;&lt;code class=&#34;language-vb&#34;&gt;Option Explicit&#xA;&#xA;Sub 汇总合并工作簿()&#xA;    Dim shtName&#xA;    Dim sht As Worksheet&#xA;&#xA;    For Each sht In ThisWorkbook.Worksheets&#xA;        shtName = shtName &amp;amp; &amp;#34;,&amp;#34; &amp;amp; sht.Name&#xA;    Next&#xA;&#xA;    Dim filePath$, fileName As String&#xA;&#xA;    filePath = ThisWorkbook.Path &amp;amp; &amp;#34;\文件夹\&amp;#34;&#xA;    fileName = Dir(filePath &amp;amp; &amp;#34;*.xlsx&amp;#34;)&#xA;&#xA;    Dim row_count, thisRow_count&#xA;    Application.ScreenUpdating = False&#xA;    Do While fileName &amp;lt;&amp;gt; &amp;#34;&amp;#34;&#xA;        With Workbooks.Open(filePath &amp;amp; fileName)&#xA;            For Each sht In .Worksheets&#xA;                If InStr(&amp;#34;,&amp;#34; &amp;amp; shtName &amp;amp; &amp;#34;,&amp;#34;, &amp;#34;,&amp;#34; &amp;amp; sht.Name &amp;amp; &amp;#34;,&amp;#34;) &amp;gt; 0 Then&#xA;                    row_count = sht.[a65536].End(3).Row&#xA;                    thisRow_count = ThisWorkbook.Worksheets(sht.Name).[a65536].End(3).Row&#xA;                    sht.Range(&amp;#34;a2:e&amp;#34; &amp;amp; row_count).Copy ThisWorkbook.Worksheets(sht.Name).Range(&amp;#34;a&amp;#34; &amp;amp; thisRow_count + 1)&#xA;                Else&#xA;                    sht.Copy after:=ThisWorkbook.Worksheets(ThisWorkbook.Worksheets.Count)&#xA;                    shtName = shtName &amp;amp; &amp;#34;,&amp;#34; &amp;amp; sht.Name&#xA;                End If&#xA;            Next&#xA;            .Close False&#xA;        End With&#xA;        fileName = Dir&#xA;    Loop&#xA;    Application.ScreenUpdating = True&#xA;&#xA;End Sub&lt;/code&gt;&lt;/pre&gt;&#xA;  &lt;/div&gt;&#xA;  &lt;button class=&#34;code-block__expand&#34; type=&#34;button&#34; data-code-expand hidden&gt;展开全部&lt;/button&gt;&#xA;&lt;/figure&gt;&#xA;&lt;p&gt;&lt;a href=&#34;https://mp.weixin.qq.com/s?__biz=MzIyOTc3NzQ2NA==&amp;amp;mid=2247485296&amp;amp;idx=1&amp;amp;sn=368ced654f9b46912baa0fba537656af&amp;amp;chksm=e8bcce27dfcb4731f5192f230ed000202ad3c401136f1d56d70c53a901bf99ab6d377d416eaf&amp;amp;scene=178&amp;amp;cur_album_id=3115603487041503237#rd&#34;&gt;原始链接&lt;/a&gt;&lt;/p&gt;</description>
			</item>
			<item>
				<title>a段落处理</title>
				<link>http://localhost:1313/r/a%E6%AE%B5%E8%90%BD%E5%A4%84%E7%90%86.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/a%E6%AE%B5%E8%90%BD%E5%A4%84%E7%90%86.html</guid>
				<description>&lt;h2 id=&#34;a段落处理&#34;&gt;a段落处理&lt;/h2&gt;</description>
			</item>
			<item>
				<title>b表单处理</title>
				<link>http://localhost:1313/r/b%E8%A1%A8%E5%8D%95%E5%A4%84%E7%90%86.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/b%E8%A1%A8%E5%8D%95%E5%A4%84%E7%90%86.html</guid>
				<description>&lt;h2 id=&#34;b表单处理&#34;&gt;b表单处理&lt;/h2&gt;</description>
			</item>
			<item>
				<title>c数字</title>
				<link>http://localhost:1313/r/c%E6%95%B0%E5%AD%97.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/c%E6%95%B0%E5%AD%97.html</guid>
				<description>&lt;h2 id=&#34;c数字&#34;&gt;c数字&lt;/h2&gt;</description>
			</item>
			<item>
				<title>d文字</title>
				<link>http://localhost:1313/r/d%E6%96%87%E5%AD%97.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/d%E6%96%87%E5%AD%97.html</guid>
				<description>&lt;h2 id=&#34;d文字&#34;&gt;d文字&lt;/h2&gt;</description>
			</item>
			<item>
				<title>e大纲</title>
				<link>http://localhost:1313/r/e%E5%A4%A7%E7%BA%B2.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/e%E5%A4%A7%E7%BA%B2.html</guid>
				<description>&lt;h2 id=&#34;e大纲&#34;&gt;e大纲&lt;/h2&gt;</description>
			</item>
			<item>
				<title>fExcel贴数</title>
				<link>http://localhost:1313/r/fexcel%E8%B4%B4%E6%95%B0.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/fexcel%E8%B4%B4%E6%95%B0.html</guid>
				<description>&lt;h2 id=&#34;fexcel贴数&#34;&gt;fExcel贴数&lt;/h2&gt;</description>
			</item>
			<item>
				<title>g批注</title>
				<link>http://localhost:1313/r/g%E6%89%B9%E6%B3%A8.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/g%E6%89%B9%E6%B3%A8.html</guid>
				<description>&lt;h2 id=&#34;g批注&#34;&gt;g批注&lt;/h2&gt;</description>
			</item>
			<item>
				<title>h行列校验</title>
				<link>http://localhost:1313/r/h%E8%A1%8C%E5%88%97%E6%A0%A1%E9%AA%8C.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/h%E8%A1%8C%E5%88%97%E6%A0%A1%E9%AA%8C.html</guid>
				<description>&lt;h2 id=&#34;h行列校验&#34;&gt;h行列校验&lt;/h2&gt;</description>
			</item>
			<item>
				<title>i多表处理</title>
				<link>http://localhost:1313/r/i%E5%A4%9A%E8%A1%A8%E5%A4%84%E7%90%86.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/i%E5%A4%9A%E8%A1%A8%E5%A4%84%E7%90%86.html</guid>
				<description>&lt;h2 id=&#34;i多表处理&#34;&gt;i多表处理&lt;/h2&gt;</description>
			</item>
			<item>
				<title>JsonConverter</title>
				<link>http://localhost:1313/r/jsonconverter.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/jsonconverter.html</guid>
				<description>&lt;h2 id=&#34;jsonconverter&#34;&gt;JsonConverter&lt;/h2&gt;</description>
			</item>
			<item>
				<title>j页面设置</title>
				<link>http://localhost:1313/r/j%E9%A1%B5%E9%9D%A2%E8%AE%BE%E7%BD%AE.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/j%E9%A1%B5%E9%9D%A2%E8%AE%BE%E7%BD%AE.html</guid>
				<description>&lt;h2 id=&#34;j页面设置&#34;&gt;j页面设置&lt;/h2&gt;</description>
			</item>
			<item>
				<title>k访谈提纲</title>
				<link>http://localhost:1313/r/k%E8%AE%BF%E8%B0%88%E6%8F%90%E7%BA%B2.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/k%E8%AE%BF%E8%B0%88%E6%8F%90%E7%BA%B2.html</guid>
				<description>&lt;h2 id=&#34;k访谈提纲&#34;&gt;k访谈提纲&lt;/h2&gt;</description>
			</item>
			<item>
				<title>底稿小帮手代码</title>
				<link>http://localhost:1313/r/%E5%BA%95%E7%A8%BF%E5%B0%8F%E5%B8%AE%E6%89%8B%E4%BB%A3%E7%A0%81.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/%E5%BA%95%E7%A8%BF%E5%B0%8F%E5%B8%AE%E6%89%8B%E4%BB%A3%E7%A0%81.html</guid>
				<description>&lt;h2 id=&#34;a段落处理&#34;&gt;a段落处理&lt;/h2&gt;</description>
			</item>
			<item>
				<title>更新</title>
				<link>http://localhost:1313/r/%E6%9B%B4%E6%96%B0.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/%E6%9B%B4%E6%96%B0.html</guid>
				<description>&lt;h2 id=&#34;更新&#34;&gt;更新&lt;/h2&gt;</description>
			</item>
			<item>
				<title>类模块</title>
				<link>http://localhost:1313/r/%E7%B1%BB%E6%A8%A1%E5%9D%97.html</link>
				<pubDate>Mon, 15 May 2023 00:00:00 +0800</pubDate><author>richffan@outlook.com (richfan)</author>
				<guid>http://localhost:1313/r/%E7%B1%BB%E6%A8%A1%E5%9D%97.html</guid>
				<description>&lt;h2 id=&#34;类模块&#34;&gt;类模块&lt;/h2&gt;</description>
			</item>
	</channel>
</rss>
