<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>エクセル | nujonoa_blog</title>
	<atom:link href="https://nujonoa.com/category/%E4%BB%95%E4%BA%8B%E9%96%A2%E9%80%A3/%E3%83%9E%E3%82%AF%E3%83%ADvba/%E3%82%A8%E3%82%AF%E3%82%BB%E3%83%AB/feed/" rel="self" type="application/rss+xml" />
	<link>https://nujonoa.com</link>
	<description>人生に役立つデータ集</description>
	<lastBuildDate>Thu, 20 Apr 2023 03:10:55 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.8.3</generator>

<image>
	<url>https://nujonoa.com/wp-content/uploads/2019/04/cropped-DSC00976-e1554456145409-32x32.jpg</url>
	<title>エクセル | nujonoa_blog</title>
	<link>https://nujonoa.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>条件付き書式を一括で消す場合は、「Cells.FormatConditions.Delete」</title>
		<link>https://nujonoa.com/cells-formatconditions-delete/</link>
					<comments>https://nujonoa.com/cells-formatconditions-delete/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Thu, 20 Apr 2023 03:09:47 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<category><![CDATA[マクロ]]></category>
		<category><![CDATA[vba]]></category>
		<category><![CDATA[条件付き書式]]></category>
		<category><![CDATA[一括削除]]></category>
		<guid isPermaLink="false">https://nujonoa.com/?p=23852</guid>

					<description><![CDATA[自分の忘備録です。 目次 条件付き書式を一括で消す場合は、「Cells.FormatConditions.Delete」実は動作が重い条件付き書式 条件付き書式を一括で消す場合は、「Cells.FormatConditi [&#8230;]]]></description>
										<content:encoded><![CDATA[
<figure class="wp-block-image size-full"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2023/04/image.png"><img fetchpriority="high" decoding="async" width="685" height="217" src="https://nujonoa.com/wp-content/uploads/2023/04/image.png" alt="" class="wp-image-23853" srcset="https://nujonoa.com/wp-content/uploads/2023/04/image.png 685w, https://nujonoa.com/wp-content/uploads/2023/04/image-500x158.png 500w, https://nujonoa.com/wp-content/uploads/2023/04/image-300x95.png 300w" sizes="(max-width: 685px) 100vw, 685px" /></a></figure>



<p>自分の忘備録です。</p>




  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-2" checked><label class="toc-title" for="toc-checkbox-2">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">条件付き書式を一括で消す場合は、「Cells.FormatConditions.Delete」</a></li><li><a href="#toc2" tabindex="0">実は動作が重い条件付き書式</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">条件付き書式を一括で消す場合は、「Cells.FormatConditions.Delete」</span></h2>



<p>条件付き書式を一括で消す方法は、</p>



<p>イミディエントウインドで、</p>



<div class="wp-block-group is-style-sticky-yellow is-layout-constrained wp-block-group-is-layout-constrained">
<p><br>Cells.FormatConditions.Delete</p>
</div>



<p><br>を打ち込んでenterになります。</p>



<h2 class="wp-block-heading"><span id="toc2">実は動作が重い条件付き書式</span></h2>



<p>実はファイルが重くなってしまっている原因が、条件付き書式であることが多々ありますので、<br>一括で削除してどれくらいファイルの動きが軽くなるか、試してみるといいと思います！！！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/cells-formatconditions-delete/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】Excelにフォルダ内の画像一覧を作る方法</title>
		<link>https://nujonoa.com/how-to-make-a-list-of-images-in-a-folder-in-vbaexcel/</link>
					<comments>https://nujonoa.com/how-to-make-a-list-of-images-in-a-folder-in-vbaexcel/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Thu, 21 Apr 2022 14:08:06 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=11120</guid>

					<description><![CDATA[忘備録です。 【VBA】Excelにフォルダ内の画像一覧を作る方法 フォルダの画像を一気に張り付けて、画像一覧を作成するプログラムです。 画像を確認し、一気に名前を変更したいときなどにお使いいただけるかと思います。]]></description>
										<content:encoded><![CDATA[
<p>忘備録です。</p>



<h2 class="wp-block-heading"><strong>【VBA】Excelにフォルダ内の画像一覧を作る方法</strong></h2>



<p>フォルダの画像を一気に張り付けて、画像一覧を作成するプログラムです。</p>



<p>画像を確認し、一気に名前を変更したいときなどにお使いいただけるかと思います。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
Sub JIKKOU2()

    Dim RowN As Integer
    
    ''エクセルシート上で選択した範囲内の全ての図形を削除する

    Set select_range = Range(Cells(6, 1), Cells(10000, 4))
    select_range.ClearContents
    If ActiveSheet.Shapes.Count &gt; 2 Then
        For i = ActiveSheet.Shapes.Count To 1 Step -1
            With ActiveSheet.Shapes(i)
                Set shp_rng = Range(.TopLeftCell, .BottomRightCell)
                If Not Intersect(shp_rng, select_range) Is Nothing Then
                    ActiveSheet.Shapes(i).Delete
                End If
            End With
        Next i
    End If
        
    Application.ScreenUpdating = False '画面更新をOFF
    Application.Calculation = xlManual '自動計算をOFF
    Application.EnableEvents = False 'イベントをOFF
    
    LASTY = Cells(Rows.Count, 2).End(xlUp).Row '1を任意に替える
        
    Call searchPic(Cells(3, 4), 6) '←検索したいフォルダを指定する。ColNは張り付け始める位置。
         
    Application.ScreenUpdating = True '画面更新をON
    Application.Calculation = xlAutomatic '自動計算をON
    Application.EnableEvents = True 'イベントをON
     
End Sub
  
Sub searchPic(PATH As String, ColN As Integer)
    Dim buf As String, childf As Object
 
'フォルダ内全部
    buf = Dir(PATH &amp; &quot;\*.png&quot;)
   
    Do While buf &lt;&gt; &quot;&quot;
     
        Cells(ColN, 1).Value = ParentDirName(PATH)
        Cells(ColN, 2).Value = buf
        Cells(ColN, 3).Activate
       '名前が一致したら実行するように指示。
       
        myFileName = PATH &amp; &quot;\&quot; &amp; buf
         
        '--(1) 選択位置に画像ファイルを挿入し、変数myShapeに格納
        Set myShape = ActiveSheet.Shapes.AddPicture( _
              Filename:=myFileName, _
              LinkToFile:=True, _
              SaveWithDocument:=False, _
              Left:=Selection.Left + 1, _
              Top:=Selection.Top + 1, _
              Width:=0, _
              Height:=0)
              
        '--(2) 挿入した画像に対して元画像と同じ高さ・幅にする
        With myShape
            .ScaleHeight 1.5, msoTrue
            .ScaleWidth 1.5, msoTrue
        End With
            
        ColN = ColN + 1
        
       
       '次のファイル
           buf = Dir()
    Loop
     
    '子フォルダも同様に、subFolderを実行する。
    With CreateObject(&quot;Scripting.FileSystemObject&quot;)
        For Each childf In .GetFolder(PATH).SubFolders
            Call searchKatashiki(childf.PATH, ColN)
        Next
    End With
     
End Sub


Function ParentDirName(PATH As String) As String

    ParentDirName = Left(PATH, InStrRev(PATH, &quot;\&quot;) - 1)
    ParentDirName = Mid(ParentDirName, InStrRev(ParentDirName, &quot;\&quot;) + 1)
    


'  With ThisWorkbook
'    ParentDirName = Left(ParentDirName, InStrRev(ParentDirName, &quot;\&quot;) - 1)
'  End With


End Function

</pre></div>]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/how-to-make-a-list-of-images-in-a-folder-in-vbaexcel/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】指定したフォルダのファイル一覧を取得、名前を一括で変更する方法</title>
		<link>https://nujonoa.com/batch-conversion-of-names-in-folders/</link>
					<comments>https://nujonoa.com/batch-conversion-of-names-in-folders/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Thu, 07 Apr 2022 03:00:00 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=11104</guid>

					<description><![CDATA[名前一括変換の忘備録です。 【VBA】指定したフォルダのファイル一覧とリンクを取得 まずは、指定したフォルダのファイル一覧と、そのリンクを取得するプログラムで、ファイル一覧を取得します。 そのあと、F列に変更したい名前を [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p>名前一括変換の忘備録です。</p>



<h2 class="wp-block-heading">【VBA】指定したフォルダのファイル一覧とリンクを取得</h2>



<p>まずは、指定したフォルダのファイル一覧と、そのリンクを取得するプログラムで、<br>ファイル一覧を取得します。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
Sub ファイル一覧()
Dim buf As String
Dim i As Long
Dim Path As String
 
'フォルダの選択
    With Application.FileDialog(msoFileDialogFolderPicker)
    .Show
    Path = .SelectedItems(1)
    End With
 
'エクセルのみ抽出
    buf = Dir(Path &amp; &quot;\*.xlsx&quot;)
    
    Cells(2, 3).Value = &quot;フォルダ⇒&quot;
    Cells(2, 4).Value = &quot;=HYPERLINK(&quot;&quot;&quot; &amp; Path &amp; &quot;&quot;&quot;,&quot;&quot;リンク&quot;&quot;)&quot;
    Cells(2, 5) = Path
     
     
'CELL B2からスタート。
     
     
   Cells(4, 2) = &quot;No&quot;
   Cells(4, 3) = &quot;ファイル名&quot;
   Cells(4, 4) = &quot;リンク&quot;
   Cells(4, 5) = &quot;パス&quot;
   Cells(4, 6) = &quot;名前を変更したい場合↓&quot;
      
     i = 4
     
    Do While buf &lt;&gt; &quot;&quot;
        i = i + 1
'No
        Cells(i, 2) = i - 4
'ファイル名
        Cells(i, 3) = buf
'リンクを
        LINK = Path &amp; &quot;\&quot; &amp; buf
        Cells(i, 4).Value = &quot;=HYPERLINK(&quot;&quot;&quot; &amp; LINK &amp; &quot;&quot;&quot;,&quot;&quot;リンク&quot;&quot;)&quot;
        Cells(i, 5).Value = LINK
 
        buf = Dir()
    Loop
    
    Columns(5).ShrinkToFit = True

    
 
End Sub
</pre></div>


<p>そのあと、F列に変更したい名前を入力し、<br>下記プログラムを実行することで、名前を変更します。<br>(.xlsxなどを入力しなくても、同様の拡張子をつけるようにif分岐させています)</p>



<figure class="wp-block-image size-large"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2022/04/image-2.png"><img decoding="async" width="900" height="362" src="https://nujonoa.com/wp-content/uploads/2022/04/image-2-900x362.png" alt="" class="wp-image-11105" srcset="https://nujonoa.com/wp-content/uploads/2022/04/image-2-900x362.png 900w, https://nujonoa.com/wp-content/uploads/2022/04/image-2-500x201.png 500w, https://nujonoa.com/wp-content/uploads/2022/04/image-2-300x121.png 300w, https://nujonoa.com/wp-content/uploads/2022/04/image-2-768x309.png 768w, https://nujonoa.com/wp-content/uploads/2022/04/image-2.png 1167w" sizes="(max-width: 900px) 100vw, 900px" /></a></figure>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
Sub ファイル名前変更()
Dim buf As String
Dim i As Long
Dim Path As String
 
'フォルダの選択
    Path = Cells(2, 5)
    
    LASTY = Cells(Rows.Count, 3).End(xlUp).Row

    For i = 5 To LASTY
    
        If Cells(i, 6) &lt;&gt; &quot;&quot; Then
        
            OldName = Path &amp; &quot;\&quot; &amp; Cells(i, 3)

            '拡張子有り無しで分岐
            If InStr(1, Cells(i, 6), &quot;.&quot;) &gt; 0 Then
            
                NewName = Path &amp; &quot;\&quot; &amp; Cells(i, 6)
            
            Else
            
                KAKUCHOUSHI = Mid(Cells(i, 3), InStr(1, Cells(i, 3), &quot;.&quot;))
                NewName = Path &amp; &quot;\&quot; &amp; Cells(i, 6) &amp; KAKUCHOUSHI
            
            End If
        
            '名前の変更
            Name OldName As NewName
            Cells(i, 7) = &quot;完了&quot;
        
        End If
    
    Next
 
End Sub

</pre></div>


<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/batch-conversion-of-names-in-folders/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】指定したフォルダのファイル一覧とリンクを取得</title>
		<link>https://nujonoa.com/vba-get-file-list-and-link-of-specified-folder/</link>
					<comments>https://nujonoa.com/vba-get-file-list-and-link-of-specified-folder/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Mon, 04 Apr 2022 13:13:27 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=11095</guid>

					<description><![CDATA[忘備録 【VBA】指定したフォルダのファイル一覧とリンクを取得 指定したフォルダの一覧と、そのリンクを取得するプログラムになります。]]></description>
										<content:encoded><![CDATA[
<p>忘備録</p>



<h2 class="wp-block-heading">【VBA】指定したフォルダのファイル一覧とリンクを取得</h2>



<p>指定したフォルダの一覧と、そのリンクを取得するプログラムになります。</p>



<p></p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
Sub ファイル一覧()
Dim buf As String
Dim i As Long
Dim Path As String

'フォルダの選択
    With Application.FileDialog(msoFileDialogFolderPicker)
    .Show
    Path = .SelectedItems(1)
    End With

'エクセルのみ抽出
    buf = Dir(Path &amp; &quot;\*.xlsx&quot;)

'CELL B2からスタート。    
     i = 1
    Do While buf &lt;&gt; &quot;&quot;
        i = i + 1
'No
        Cells(i, 2) = i
'ファイル名
        Cells(i, 3) = buf
'リンクを
        LINK = Path &amp; &quot;\&quot; &amp; buf
        Cells(i, 4).Value = &quot;=HYPERLINK(&quot;&quot;&quot; &amp; LINK &amp; &quot;&quot;&quot;,&quot;&quot;リンク&quot;&quot;)&quot;

        buf = Dir()
    Loop

End Sub


</pre></div>]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/vba-get-file-list-and-link-of-specified-folder/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>ウォーターフォールグラフのエクセルフォーマット</title>
		<link>https://nujonoa.com/template-of-waterfall-graph/</link>
					<comments>https://nujonoa.com/template-of-waterfall-graph/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Wed, 06 Oct 2021 04:28:41 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<category><![CDATA[仕事関連]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=9725</guid>

					<description><![CDATA[目次 階段グラフ(ウォーターフォール)のフォーマット使用例はこちら使い方 階段グラフ(ウォーターフォール)のフォーマット 決算資料などでよくある、 「階段グラフ」 ですが、これを使えると、前回からの変更点などを視覚化する [&#8230;]]]></description>
										<content:encoded><![CDATA[

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-10" checked><label class="toc-title" for="toc-checkbox-10">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">階段グラフ(ウォーターフォール)のフォーマット</a></li><li><a href="#toc2" tabindex="0">使用例はこちら</a></li><li><a href="#toc3" tabindex="0">使い方</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">階段グラフ(ウォーターフォール)のフォーマット</span></h2>



<p>決算資料などでよくある、</p>



<p>「階段グラフ」</p>



<p>ですが、これを使えると、前回からの変更点などを視覚化することができ、<br>非常に便利です。</p>



<p>最新版のエクセルでは、グラフの一つとして作れるようになっているようですが、<br>昔のエクセルなどでも使えるようにテンプレートを作成しましたので、</p>



<p>もしよかったら使って頂けたら幸いです。</p>



<h2 class="wp-block-heading"><span id="toc2">使用例はこちら</span></h2>



<p>使用例は、こちらの通りで、<br>値を入力することで、<br>・ベースとなる棒<br>・プラス、マイナスとなる棒<br>が表示され、下記の通り変化を記録できます。<br>(下の場合は、給料の額面から手取りまでの差になっています)</p>



<figure class="wp-block-image size-large"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/10/image.png"><img decoding="async" width="900" height="552" src="https://nujonoa.com/wp-content/uploads/2021/10/image-900x552.png" alt="手取りの変化を階段グラフで確認。ウォーターフォールグラフの例" class="wp-image-9736" srcset="https://nujonoa.com/wp-content/uploads/2021/10/image-900x552.png 900w, https://nujonoa.com/wp-content/uploads/2021/10/image-500x307.png 500w, https://nujonoa.com/wp-content/uploads/2021/10/image-300x184.png 300w, https://nujonoa.com/wp-content/uploads/2021/10/image-768x471.png 768w, https://nujonoa.com/wp-content/uploads/2021/10/image.png 1149w" sizes="(max-width: 900px) 100vw, 900px" /></a><figcaption>手取りの変化を階段グラフで確認</figcaption></figure>



<div class="wp-block-file"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/10/ウォーターフォールグラフのテンプレート.xlsx">ウォーターフォールグラフのテンプレート<span class="fa fa-external-link internal-icon anchor-icon"></span></a><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/10/ウォーターフォールグラフのテンプレート.xlsx" class="wp-block-file__button" download>ダウンロード<span class="fa fa-external-link internal-icon anchor-icon"></span></a></div>



<h2 class="wp-block-heading"><span id="toc3">使い方</span></h2>



<p>使い方は、上部にある、<br>・ベースとなる値<br>・コスト増<br>・コスト減<br>を入力して頂ければ、下記の通りグラフが完成します。</p>



<figure class="wp-block-image size-full"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/10/image-1.png"><img loading="lazy" decoding="async" width="823" height="677" src="https://nujonoa.com/wp-content/uploads/2021/10/image-1.png" alt="階段グラフの使い方" class="wp-image-9737" srcset="https://nujonoa.com/wp-content/uploads/2021/10/image-1.png 823w, https://nujonoa.com/wp-content/uploads/2021/10/image-1-500x411.png 500w, https://nujonoa.com/wp-content/uploads/2021/10/image-1-300x247.png 300w, https://nujonoa.com/wp-content/uploads/2021/10/image-1-768x632.png 768w" sizes="(max-width: 823px) 100vw, 823px" /></a></figure>



<p>ぜひ活用してみてください。</p>



<div class="wp-block-file"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/10/ウォーターフォールグラフのテンプレート.xlsx">ウォーターフォールグラフのテンプレート<span class="fa fa-external-link internal-icon anchor-icon"></span></a><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/10/ウォーターフォールグラフのテンプレート.xlsx" class="wp-block-file__button" download>ダウンロード<span class="fa fa-external-link internal-icon anchor-icon"></span></a></div>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/template-of-waterfall-graph/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>VBA→VBSの変換！VBS→VBAの起動を！</title>
		<link>https://nujonoa.com/vba-to-vbs/</link>
					<comments>https://nujonoa.com/vba-to-vbs/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Wed, 18 Aug 2021 13:43:00 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<category><![CDATA[マクロVBA]]></category>
		<category><![CDATA[VBS]]></category>
		<category><![CDATA[vba]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=9668</guid>

					<description><![CDATA[目次 VBA→VBSの変換！VBS→VBAの起動を！コードコードの説明活用方法 VBA→VBSの変換！VBS→VBAの起動を！ VBAでファイル名の変更などを行った場合、これを他の人にも展開したいなと考えることがあるかと [&#8230;]]]></description>
										<content:encoded><![CDATA[

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-12" checked><label class="toc-title" for="toc-checkbox-12">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">VBA→VBSの変換！VBS→VBAの起動を！</a></li><li><a href="#toc2" tabindex="0">コード</a></li><li><a href="#toc3" tabindex="0">コードの説明</a></li><li><a href="#toc4" tabindex="0">活用方法</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">VBA→VBSの変換！VBS→VBAの起動を！</span></h2>



<p>VBAでファイル名の変更などを行った場合、<br>これを他の人にも展開したいなと考えることがあるかと思います。</p>



<p>そこでお勧めするのが、VBSを用いる方法です。</p>



<h2 class="wp-block-heading"><span id="toc2">コード</span></h2>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
Dim ExcelApp
Dim ExcelBook
Dim FilePath

FilePath = &quot;G:\共有ドライブ\TEST_FOLDER\utf-8_to_shiftjis.xlsm&quot; '←ここを変更
VBA_P = &quot;TEST1&quot; '←ここを変更

Set ExcelApp=CreateObject(&quot;Excel.Application&quot;)
Set ExcelBook= ExcelApp.Workbooks.Open(FilePath)
ExcelApp.ActiveWorkbook.Worksheets(1).select

ExcelApp.visible = false

ExcelApp.Run VBA_P

ExcelBook.Close True
ExcelApp.quit

Set ExcelApp=Nothing
Set ExcelBook=Nothing
</pre></div>


<h2 class="wp-block-heading"><span id="toc3">コードの説明</span></h2>



<p>コードは非常に簡単で、</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
Set ExcelApp=CreateObject(&quot;Excel.Application&quot;)
Set ExcelBook= ExcelApp.Workbooks.Open(FilePath)
</pre></div>


<p>でエクセルを立ち上げて</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
ExcelApp.ActiveWorkbook.Worksheets(1).select
</pre></div>


<p>でワークシートを指定して</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
ExcelApp.visible = false

ExcelApp.Run VBA_P
</pre></div>


<p>Excelを見えないように、マクロをはしらせ</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
ExcelBook.Close True
ExcelApp.quit

Set ExcelApp=Nothing
Set ExcelBook=Nothing
</pre></div>


<p>これで、エクセルを閉じております。</p>



<h2 class="wp-block-heading"><span id="toc4">活用方法</span></h2>



<p>活用方法としては、</p>



<p>1ヶ月、1週間毎に繰り返し行う集計、更新作業などを、<br>ワンクリックで更新することができるようになります。</p>



<p>また、</p>



<p>ExcelApp.visible = True '←F<br>'コメントに変換　ExcelBook.Close True</p>



<p>で、エクセルファイルをそのまま立ち上げたまま、<br>チェック作業に入ることも可能です。</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/vba-to-vbs/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】ファイルを立ち上げずに、セルの情報を抜き出す方法</title>
		<link>https://nujonoa.com/how-to-extract-information-without-launching-a-file/</link>
					<comments>https://nujonoa.com/how-to-extract-information-without-launching-a-file/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Thu, 04 Feb 2021 14:07:43 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<category><![CDATA[マクロVBA]]></category>
		<category><![CDATA[セル]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[フォルダ内]]></category>
		<category><![CDATA[全ファイル]]></category>
		<category><![CDATA[全シート]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=8763</guid>

					<description><![CDATA[目次 【VBA】ファイルを立ち上げずに、エクセルの情報を抜き出す方法プログラム紹介プログラムの説明まとめ 【VBA】ファイルを立ち上げずに、エクセルの情報を抜き出す方法 エクセルで他のシートからセルの情報を持ってこようと [&#8230;]]]></description>
										<content:encoded><![CDATA[

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-14" checked><label class="toc-title" for="toc-checkbox-14">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">【VBA】ファイルを立ち上げずに、エクセルの情報を抜き出す方法</a></li><li><a href="#toc2" tabindex="0">プログラム紹介</a></li><li><a href="#toc3" tabindex="0">プログラムの説明</a></li><li><a href="#toc4" tabindex="0">まとめ</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">【VBA】ファイルを立ち上げずに、エクセルの情報を抜き出す方法</span></h2>



<p>エクセルで他のシートからセルの情報を持ってこようとすると、<br>ブックを立ち上げて、情報をコピーして、閉じてを繰り返し行う必要があります。</p>



<p>が、そんなことやっていたら日が暮れてしまいますよね。。</p>



<p>そこで今回は、ファイルを立ち上げずに、下記のように</p>



<p>・特定のフォルダ内の<br>・全ブックの<br>・全シートの<br>・特定のセルの情報<br>を持ってくる方法を紹介したいと思います。</p>



<figure class="wp-block-image size-large"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/01/image-50.png"><img loading="lazy" decoding="async" width="900" height="518" src="https://nujonoa.com/wp-content/uploads/2021/01/image-50-900x518.png" alt="フォルダ内の全ファイル全シートの情報を抜き出す。" class="wp-image-8598" srcset="https://nujonoa.com/wp-content/uploads/2021/01/image-50-900x518.png 900w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-500x288.png 500w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-300x173.png 300w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-768x442.png 768w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-120x68.png 120w, https://nujonoa.com/wp-content/uploads/2021/01/image-50.png 972w" sizes="(max-width: 900px) 100vw, 900px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc2">プログラム紹介</span></h2>



<p>プログラムを動かす前に、</p>



<p>①VBAの編集画面「ツール→参照」で、<br><strong>Microsoft ActiveX Data Objects 2.8 Library</strong><br>を追加して下さい。<br>②フォルダパスを検索したいパスに設定してください。<br>③「任意のセルに変更」の箇所を思い通りに変更ください。</p>



<p>※ダブルクリックでコピーできます。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
Sub JIKKOU()
 
        Call DBMacro(&quot;C:\Users\bluei\OneDrive\ドキュメント\blog\fp&quot;) '←検索したいフォルダを指定する。
     
End Sub

Sub DBMacro(Path As String)
 
  Application.ScreenUpdating = False
 
'    Application.Calculation = xlCalculationManual '自動計算停止(手動計算)
 
    Dim objCn As New ADODB.Connection
    Dim objRS As ADODB.Recordset
    Dim sSheet As String
    Dim i      As Long
     
 
    Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
    Set cf = fso.GetFolder(Path)
     
    Z = 2
     
    Cells(Z, 1) = &quot;ファイルへのパス&quot;
    Cells(Z, 2) = &quot;ファイル名&quot;
    Cells(Z, 3) = &quot;シート名&quot;
    Cells(Z, 4) = &quot;計算用&quot;
    Cells(Z, 5) = &quot;フォルダパス&quot;
    Cells(Z, 6) = &quot;シートへのリンク&quot;
    Cells(Z, 7) = &quot;ここからセルの値⇒⇒&quot;
    Z = Z + 1
     
    For Each sFile In cf.Files
  
    If sFile = &quot;False&quot; Then
        Exit Sub
    End If
     
    If sFile.Name Like &quot;*.xls*&quot; Then
     
    Else
        GoTo Continue
    End If
   
'db関数を使用。
    With objCn
        .Provider = &quot;Microsoft.ACE.OLEDB.12.0&quot;
        .Properties(&quot;Extended Properties&quot;) = &quot;Excel 12.0&quot;
        .Open sFile
        Set objRS = .OpenSchema(ADODB.adSchemaTables)
    End With
 
’シート名を取り出す作業
    Do Until objRS.EOF
        sSheet = objRS.Fields(&quot;TABLE_NAME&quot;).Value
        If Right(sSheet, 1) = &quot;$&quot; Or Right(sSheet, 2) = &quot;$'&quot; Then
            If Right(sSheet, 1) = &quot;$&quot; Then
                sSheet = Left(sSheet, Len(sSheet) - 1)
            End If
            If Right(sSheet, 2) = &quot;$'&quot; Then
                sSheet = Left(sSheet, Len(sSheet) - 2)
            End If
            If Left(sSheet, 1) = &quot;'&quot; Then
                sSheet = Mid(sSheet, 2)
            End If
            sSheet = Replace(sSheet, &quot;''&quot;, &quot;'&quot;)
   
'情報を張っていく。
     Application.DisplayAlerts = False
             
            Cells(Z, 1) = sFile.Path
            Cells(Z, 2) = sFile.Name
            Cells(Z, 3) = &quot;'&quot; &amp; Replace(sSheet, &quot;#&quot;, &quot;.&quot;)
             
            Cells(Z, 4) = InStrRev(Cells(Z, 1), &quot;\&quot;)
            Cells(Z, 5) = Left(Cells(Z, 1), Cells(Z, 4))
            CELLPASS = &quot;'&quot; &amp; Cells(Z, 5) &amp; &quot;&#x5B;&quot; &amp; Cells(Z, 2) &amp; &quot;]&quot; &amp; Cells(Z, 3) &amp; &quot;'!&quot;
            Cells(Z, 6) = &quot;=HYPERLINK(A&quot; &amp; Z &amp; &quot;&amp;&quot;&quot;#&quot;&quot;&amp;C&quot; &amp; Z &amp; &quot;&amp;&quot;&quot;!A1&quot;&quot;,&quot;&quot;リンク&quot;&quot;)&quot;
             
            Cells(Z, 7) = &quot;=&quot; &amp; CELLPASS &amp; &quot;F6&quot;  '任意のセルに変更
            Cells(Z, 8) = &quot;=&quot; &amp; CELLPASS &amp; &quot;Y6&quot;  '任意のセルに変更
            Cells(Z, 9) = &quot;=&quot; &amp; CELLPASS &amp; &quot;M9&quot;  '任意のセルに変更
            Cells(Z, 10) = &quot;=&quot; &amp; CELLPASS &amp; &quot;M15&quot;  '任意のセルに変更
            Cells(Z, 11) = &quot;=&quot; &amp; CELLPASS &amp; &quot;E19&quot;  '任意のセルに変更
            Cells(Z, 12) = &quot;=&quot; &amp; CELLPASS &amp; &quot;B26&quot;  '任意のセルに変更
            Cells(Z, 13) = &quot;=&quot; &amp; CELLPASS &amp; &quot;I26&quot;  '任意のセルに変更
            Cells(Z, 14) = &quot;=&quot; &amp; CELLPASS &amp; &quot;P26&quot;  '任意のセルに変更
            Cells(Z, 15) = &quot;=&quot; &amp; CELLPASS &amp; &quot;B28&quot;  '任意のセルに変更

 
            DoEvents  '重すぎるのでフリーズしないように入れる。
 
'シートをリンクさせないバージョン↓
'            Cells(Z, 8).Value = ExecuteExcel4Macro(&quot;'&quot; &amp; Cells(Z, 5) &amp; &quot;&#x5B;&quot; &amp; Cells(Z, 2) &amp; &quot;]&quot; &amp; Cells(Z, 3) &amp; &quot;'!R26C2&quot;)
             
             
        Application.DisplayAlerts = True
             
             
            Z = Z + 1
        End If
        objRS.MoveNext
    Loop
    objRS.Close
    objCn.Close
    Set objRS = Nothing
    Set objCn = Nothing
     
        Application.StatusBar = Z
     
Continue:
    Next

    '子フォルダも同様に、subFolderを実行する。
    With CreateObject(&quot;Scripting.FileSystemObject&quot;)
        For Each childf In .GetFolder(Path).SubFolders
            Call DBMacro(childf.Path)
        Next
    End With
     
    Application.Calculation = xlCalculationAutomatic '自動計算開始
    
    Range(Cells(1, 1), Cells(Z, 30)).Formula = Range(Cells(1, 1), Cells(Z, 30)).Formula
    
  Application.ScreenUpdating = True
     
End Sub


</pre></div>


<h2 class="wp-block-heading"><span id="toc3">プログラムの説明</span></h2>



<p></p>



<p>ADOを使って、エクセルをDBとみなして、<br>各ファイルのシートをすべてとってきています。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
'db関数を使用。
    With objCn
        .Provider = &quot;Microsoft.ACE.OLEDB.12.0&quot;
        .Properties(&quot;Extended Properties&quot;) = &quot;Excel 12.0&quot;
        .Open sFile
        Set objRS = .OpenSchema(ADODB.adSchemaTables)
    End With
 
’シート名を取り出す作業
    Do Until objRS.EOF
        sSheet = objRS.Fields(&quot;TABLE_NAME&quot;).Value
        If Right(sSheet, 1) = &quot;$&quot; Or Right(sSheet, 2) = &quot;$'&quot; Then
            If Right(sSheet, 1) = &quot;$&quot; Then
                sSheet = Left(sSheet, Len(sSheet) - 1)
            End If
            If Right(sSheet, 2) = &quot;$'&quot; Then
                sSheet = Left(sSheet, Len(sSheet) - 2)
            End If
            If Left(sSheet, 1) = &quot;'&quot; Then
                sSheet = Mid(sSheet, 2)
            End If
            sSheet = Replace(sSheet, &quot;''&quot;, &quot;'&quot;)
</pre></div>


<p>その情報を使って、<br>・そのブックにリンクを作っていきます。<br>【＝'パス名[ブック名]シート名'セル名】<br>例)='C:\Users\bluei\OneDrive\ドキュメント\blog\fp[(201912)簡易FP.xlsx]→'!F6】</p>



<p>他のファイルで↓の表示が出ると、かなり萎えますが、今回の場合は、これを思う存分行うようにしています。</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/01/image-51.png"><img loading="lazy" decoding="async" width="726" height="138" src="https://nujonoa.com/wp-content/uploads/2021/01/image-51.png" alt="安全ではない可能性のある外部ソースへのリンクが" class="wp-image-8600" srcset="https://nujonoa.com/wp-content/uploads/2021/01/image-51.png 726w, https://nujonoa.com/wp-content/uploads/2021/01/image-51-500x95.png 500w, https://nujonoa.com/wp-content/uploads/2021/01/image-51-300x57.png 300w" sizes="(max-width: 726px) 100vw, 726px" /></a></figure></div>



<p>そのまま数式は残してありますが、最後にコピーして値貼り付けをすれば、<br>このリンクは削除できますので、変に重たいファイルになることを防ぐことも可能です。</p>



<h2 class="wp-block-heading"><span id="toc4">まとめ</span></h2>



<p>暗黙知を形式知にしたり、情報の共有を図るために、</p>



<p>・何かしらのフォーマットにある程度のルールにのっとったファイル</p>



<p>を作っていくことがあると思いますが、<br>残念ながらそれがうまく活用されることが少ないように感じます。</p>



<p>そのハードルを下げるためにも、誰もが使っているエクセルで、<br>DBを作ることに意味はあると思います。</p>



<p>是非検討してみてください！！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/how-to-extract-information-without-launching-a-file/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【エクセルDB】フォルダ内の全ファイル全シートのセルの情報を書き出す。</title>
		<link>https://nujonoa.com/extract-cell-information-of-all-files-and-all-sheets/</link>
					<comments>https://nujonoa.com/extract-cell-information-of-all-files-and-all-sheets/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Sat, 23 Jan 2021 13:53:11 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<category><![CDATA[google spreadsheet]]></category>
		<category><![CDATA[セル]]></category>
		<category><![CDATA[データベース]]></category>
		<category><![CDATA[フォルダ内]]></category>
		<category><![CDATA[全ファイル]]></category>
		<category><![CDATA[全シート]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=8184</guid>

					<description><![CDATA[目次 【エクセルDB】フォルダ内の全ファイル全シートの情報を書き出す。プログラム紹介プログラムの説明まとめ 【エクセルDB】フォルダ内の全ファイル全シートの情報を書き出す。 エクセルは時代遅れ、、、といわれながらも、社内 [&#8230;]]]></description>
										<content:encoded><![CDATA[

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-16" checked><label class="toc-title" for="toc-checkbox-16">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">【エクセルDB】フォルダ内の全ファイル全シートの情報を書き出す。</a></li><li><a href="#toc2" tabindex="0">プログラム紹介</a></li><li><a href="#toc3" tabindex="0">プログラムの説明</a></li><li><a href="#toc4" tabindex="0">まとめ</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">【エクセルDB】フォルダ内の全ファイル全シートの情報を書き出す。</span></h2>



<p>エクセルは時代遅れ、、、といわれながらも、<br>社内外のやり取りはエクセルで行われるのが主ですし、<br>これからもそれがどっと変わることはないでしょう。<br>※スプレッドシートはありかなと思うのですが…<br>　結局なんやかんや表計算ソフトは便利です。</p>



<p>そこで、今回はエクセルデータベースをVBAで無理やり作ってみました。</p>



<p>出来ることは、下記画像の通り、<br><strong>対象のフォルダ内のエクセルシートの</strong><br>・ファイルのパス<br>・エクセルのファイル名<br>・エクセルのシート名<br>・そのシートへのリンク<br>・そのシートの対象のセルの値を読み込む。</p>



<figure class="wp-block-image size-large"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/01/image-50.png"><img loading="lazy" decoding="async" width="900" height="518" src="https://nujonoa.com/wp-content/uploads/2021/01/image-50-900x518.png" alt="フォルダ内の全ファイル全シートの情報を抜き出す。" class="wp-image-8598" srcset="https://nujonoa.com/wp-content/uploads/2021/01/image-50-900x518.png 900w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-500x288.png 500w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-300x173.png 300w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-768x442.png 768w, https://nujonoa.com/wp-content/uploads/2021/01/image-50-120x68.png 120w, https://nujonoa.com/wp-content/uploads/2021/01/image-50.png 972w" sizes="(max-width: 900px) 100vw, 900px" /></a></figure>



<p>というプログラムです。</p>



<p>フォルダと、セルの値だけ変えてもらえればすぐに使えますので、<br>ぜひ参考にしてみてください！！！</p>



<h2 class="wp-block-heading"><span id="toc2">プログラム紹介</span></h2>



<p>プログラムを動かす前に、</p>



<p>①VBAの編集画面「ツール→参照」で、<br><strong>Microsoft ActiveX Data Objects 2.8 Library</strong><br>を追加して下さい。<br>②フォルダパスを検索したいパスに設定してください。<br>③「任意のセルに変更」の箇所を思い通りに変更ください。</p>



<p>それが出来たら実行してください。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
Sub DBMacro(Path As String)
 
  Application.ScreenUpdating = False
 
'    Application.Calculation = xlCalculationManual '自動計算停止(手動計算)
 
    Dim objCn As New ADODB.Connection
    Dim objRS As ADODB.Recordset
    Dim sSheet As String
    Dim i      As Long
     
 
    Set fso = CreateObject(&quot;Scripting.FileSystemObject&quot;)
    Set cf = fso.GetFolder(Path)
     
    Z = 2
     
    Cells(Z, 1) = &quot;ファイルへのパス&quot;
    Cells(Z, 2) = &quot;ファイル名&quot;
    Cells(Z, 3) = &quot;シート名&quot;
    Cells(Z, 4) = &quot;計算用&quot;
    Cells(Z, 5) = &quot;フォルダパス&quot;
    Cells(Z, 6) = &quot;シートへのリンク&quot;
    Cells(Z, 7) = &quot;ここからセルの値⇒⇒&quot;
    Z = Z + 1
     
     
     
    '直下
     
    For Each sFile In cf.Files
     
  
    If sFile = &quot;False&quot; Then
        Exit Sub
    End If
     
    If sFile.Name Like &quot;*.xls*&quot; Then
     
    Else
        GoTo Continue
    End If
   
    With objCn
        .Provider = &quot;Microsoft.ACE.OLEDB.12.0&quot;
        .Properties(&quot;Extended Properties&quot;) = &quot;Excel 12.0&quot;
        .Open sFile
        Set objRS = .OpenSchema(ADODB.adSchemaTables)
    End With
 
    Do Until objRS.EOF
        sSheet = objRS.Fields(&quot;TABLE_NAME&quot;).Value
        If Right(sSheet, 1) = &quot;$&quot; Or Right(sSheet, 2) = &quot;$'&quot; Then
            If Right(sSheet, 1) = &quot;$&quot; Then
                sSheet = Left(sSheet, Len(sSheet) - 1)
            End If
            If Right(sSheet, 2) = &quot;$'&quot; Then
                sSheet = Left(sSheet, Len(sSheet) - 2)
            End If
            If Left(sSheet, 1) = &quot;'&quot; Then
                sSheet = Mid(sSheet, 2)
            End If
            sSheet = Replace(sSheet, &quot;''&quot;, &quot;'&quot;)
        Application.DisplayAlerts = False
             
            Cells(Z, 1) = sFile.Path
            Cells(Z, 2) = sFile.Name
            Cells(Z, 3) = &quot;'&quot; &amp; Replace(sSheet, &quot;#&quot;, &quot;.&quot;)
             
            Cells(Z, 4) = InStrRev(Cells(Z, 1), &quot;\&quot;)
            Cells(Z, 5) = Left(Cells(Z, 1), Cells(Z, 4))
            CELLPASS = &quot;'&quot; &amp; Cells(Z, 5) &amp; &quot;&#x5B;&quot; &amp; Cells(Z, 2) &amp; &quot;]&quot; &amp; Cells(Z, 3) &amp; &quot;'!&quot;
            Cells(Z, 6) = &quot;=HYPERLINK(A&quot; &amp; Z &amp; &quot;&amp;&quot;&quot;#&quot;&quot;&amp;C&quot; &amp; Z &amp; &quot;&amp;&quot;&quot;!A1&quot;&quot;,&quot;&quot;リンク&quot;&quot;)&quot;
             
            Cells(Z, 7) = &quot;=&quot; &amp; CELLPASS &amp; &quot;F6&quot;  '任意のセルに変更
            Cells(Z, 8) = &quot;=&quot; &amp; CELLPASS &amp; &quot;Y6&quot;  '任意のセルに変更
            Cells(Z, 9) = &quot;=&quot; &amp; CELLPASS &amp; &quot;M9&quot;  '任意のセルに変更
            Cells(Z, 10) = &quot;=&quot; &amp; CELLPASS &amp; &quot;M15&quot;  '任意のセルに変更
            Cells(Z, 11) = &quot;=&quot; &amp; CELLPASS &amp; &quot;E19&quot;  '任意のセルに変更
            Cells(Z, 12) = &quot;=&quot; &amp; CELLPASS &amp; &quot;B26&quot;  '任意のセルに変更
            Cells(Z, 13) = &quot;=&quot; &amp; CELLPASS &amp; &quot;I26&quot;  '任意のセルに変更
            Cells(Z, 14) = &quot;=&quot; &amp; CELLPASS &amp; &quot;P26&quot;  '任意のセルに変更
            Cells(Z, 15) = &quot;=&quot; &amp; CELLPASS &amp; &quot;B28&quot;  '任意のセルに変更
            Cells(Z, 16) = &quot;=&quot; &amp; CELLPASS &amp; &quot;I28&quot;  '任意のセルに変更
            Cells(Z, 17) = &quot;=&quot; &amp; CELLPASS &amp; &quot;N28&quot;  '任意のセルに変更
            Cells(Z, 18) = &quot;=&quot; &amp; CELLPASS &amp; &quot;I29&quot;  '任意のセルに変更
            Cells(Z, 19) = &quot;=&quot; &amp; CELLPASS &amp; &quot;P29&quot;  '任意のセルに変更
            Cells(Z, 20) = &quot;=&quot; &amp; CELLPASS &amp; &quot;W26&quot;  '任意のセルに変更
            Cells(Z, 21) = &quot;=&quot; &amp; CELLPASS &amp; &quot;AD26&quot;  '任意のセルに変更
            Cells(Z, 22) = &quot;=&quot; &amp; CELLPASS &amp; &quot;AK26&quot;  '任意のセルに変更
            Cells(Z, 23) = &quot;=&quot; &amp; CELLPASS &amp; &quot;W28&quot;  '任意のセルに変更
            Cells(Z, 24) = &quot;=&quot; &amp; CELLPASS &amp; &quot;AD28&quot;  '任意のセルに変更
            Cells(Z, 25) = &quot;=&quot; &amp; CELLPASS &amp; &quot;AI28&quot;  '任意のセルに変更
            Cells(Z, 26) = &quot;=&quot; &amp; CELLPASS &amp; &quot;AD29&quot;  '任意のセルに変更
            Cells(Z, 27) = &quot;=&quot; &amp; CELLPASS &amp; &quot;AK29&quot;  '任意のセルに変更
 
            DoEvents  '重すぎるのでフリーズしないように入れる。
 
'シートをリンクさせないバージョン↓
'            Cells(Z, 8).Value = ExecuteExcel4Macro(&quot;'&quot; &amp; Cells(Z, 5) &amp; &quot;&#x5B;&quot; &amp; Cells(Z, 2) &amp; &quot;]&quot; &amp; Cells(Z, 3) &amp; &quot;'!R26C2&quot;)
             
             
        Application.DisplayAlerts = True
             
             
            Z = Z + 1
        End If
        objRS.MoveNext
    Loop
    objRS.Close
    objCn.Close
    Set objRS = Nothing
    Set objCn = Nothing
     
        Application.StatusBar = Z
     
Continue:
    Next

    '子フォルダも同様に、subFolderを実行する。
    With CreateObject(&quot;Scripting.FileSystemObject&quot;)
        For Each childf In .GetFolder(Path).SubFolders
            Call DBMacro(childf.Path)
        Next
    End With
     
    Application.Calculation = xlCalculationAutomatic '自動計算開始
    
    
    
    Range(Cells(1, 1), Cells(Z, 30)).Formula = Range(Cells(1, 1), Cells(Z, 30)).Formula
    
  Application.ScreenUpdating = True
     
End Sub

Sub JIKKOU()
 
        Call DBMacro(&quot;C:\Users\bluei\OneDrive\ドキュメント\blog\fp&quot;) '←検索したいフォルダを指定する。
     
End Sub

</pre></div>


<h2 class="wp-block-heading"><span id="toc3">プログラムの説明</span></h2>



<p>長すぎるので、説明は端折りますが、</p>



<p>・ファイルを検索して、<br>・ファイルがエクセルの場合、その中のシートを全部読み取りハイパーリンクを作成がてら、<br>・そのシートの特定のセルへ【='C:\Users\bluei\OneDrive\ドキュメント\blog\fp[(201912)簡易FP.xlsx]→'!F6】みたいな外部リンクの数式をじゃんじゃん作っていく。</p>



<p>イメージです。</p>



<p>よくある悪者</p>



<div class="wp-block-image"><figure class="aligncenter size-large"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/01/image-51.png"><img loading="lazy" decoding="async" width="726" height="138" src="https://nujonoa.com/wp-content/uploads/2021/01/image-51.png" alt="安全ではない可能性のある外部ソースへのリンクが" class="wp-image-8600" srcset="https://nujonoa.com/wp-content/uploads/2021/01/image-51.png 726w, https://nujonoa.com/wp-content/uploads/2021/01/image-51-500x95.png 500w, https://nujonoa.com/wp-content/uploads/2021/01/image-51-300x57.png 300w" sizes="(max-width: 726px) 100vw, 726px" /></a></figure></div>



<p>を逆に存分に使ってやろうという感じになります。<br>そのまま数式は残してありますが、最後にコピーして値貼り付けをすれば、<br>このリンクは削除できますので、変に重たいファイルになることを防ぐことも可能です。</p>



<h2 class="wp-block-heading"><span id="toc4">まとめ</span></h2>



<p>結構苦労してたどり着いたプログラムなので、<br>かわいがってやってください。</p>



<p>何か要望などあれば、コメントへどうぞ！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/extract-cell-information-of-all-files-and-all-sheets/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【エクセル】条件(未満、以上)が多い場合にIF文を使わずVLOOKUPで代用する方法。</title>
		<link>https://nujonoa.com/calculation-of-multiple-thresholds/</link>
					<comments>https://nujonoa.com/calculation-of-multiple-thresholds/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Fri, 27 Nov 2020 11:00:36 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<category><![CDATA[複数条件]]></category>
		<category><![CDATA[しきい値]]></category>
		<category><![CDATA[未満]]></category>
		<category><![CDATA[以上]]></category>
		<category><![CDATA[VLOOKUP]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=7771</guid>

					<description><![CDATA[目次 【エクセル】条件(未満、以上)が多い場合にIF文を使わずVLOOKUPで代用する方法。VLOOKUPの1を使用する。数式の説明注意点 【エクセル】条件(未満、以上)が多い場合にIF文を使わずVLOOKUPで代用する [&#8230;]]]></description>
										<content:encoded><![CDATA[

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-18" checked><label class="toc-title" for="toc-checkbox-18">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">【エクセル】条件(未満、以上)が多い場合にIF文を使わずVLOOKUPで代用する方法。</a></li><li><a href="#toc2" tabindex="0">VLOOKUPの1を使用する。</a></li><li><a href="#toc3" tabindex="0">数式の説明</a><ol><li><a href="#toc4" tabindex="0">注意点</a></li></ol></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">【エクセル】条件(未満、以上)が多い場合にIF文を使わずVLOOKUPで代用する方法。</span></h2>



<p>採点結果をまとめる際に、あるしきい値毎に、</p>



<p>30点未満は不合格<br>60点未満は追試<br>それ以外は合格</p>



<p>と判断していく際には一般的にIF文が使われると思います。<br>が、</p>



<p>20点未満は　1<br>40点未満は　2<br>60点未満は　3<br>80点未満は　4<br>80点以上は　5</p>



<p>と、条件が多くなってくると</p>



<p class="is-style-sticky-gray">=IF(A1&lt;20,1,IF(A1&lt;40,2,IF(A1&lt;60,3,IF(A1&lt;80,4,5))))</p>



<p>と非常に式が複雑になります。IFSを用いても、</p>



<p class="is-style-sticky-gray">=IFS(A1&lt;20, 1, A1&lt;40, 2,A1&lt;60, 3,A1&lt;80, 4,A1&lt;=100, 5)</p>



<p>と、あまり変わりませんね…</p>



<p>そこで今回は、VLOOKUPを用いて簡単に記載していきたいと思います。</p>



<h2 class="wp-block-heading"><span id="toc2">VLOOKUPの1を使用する。</span></h2>



<p>今回紹介する関数は、<br>・VLOOKUP<br>です。</p>



<p class="is-style-default">エクセルをよく使う人にとって、<br>VLOOKUPなんていつも使っているよ！！と思われる方が多数かと思いますが、</p>



<p class="is-style-sticky-red">＝VLOOKUP(検査値,範囲,列,<strong><span class="marker-animation">1</span></strong>)</p>



<p>と、最後の数字を「1」で、近時値検索を使っている人はごく少数なのではないでしょうか？</p>



<p>今回は、「１」を使ったVLOOKUPの性質を利用して、<br>下記画像のように判定をしています。<br>・0~20点の人は1<br>・20点～40点の人は2<br>と、きちんと判定されていることがわかると思います。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="900" height="383" src="https://nujonoa.com/wp-content/uploads/2020/11/image-49-900x383.png" alt="" class="wp-image-7772" srcset="https://nujonoa.com/wp-content/uploads/2020/11/image-49-900x383.png 900w, https://nujonoa.com/wp-content/uploads/2020/11/image-49-500x213.png 500w, https://nujonoa.com/wp-content/uploads/2020/11/image-49-300x128.png 300w, https://nujonoa.com/wp-content/uploads/2020/11/image-49-768x327.png 768w, https://nujonoa.com/wp-content/uploads/2020/11/image-49.png 973w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<h2 class="wp-block-heading"><span id="toc3">数式の説明</span></h2>



<p>今回は、おなじみの関数VLOOKUPを用いて、<br>条件検索を行っています。</p>



<p>VLOOKUPの4項目、条件式を「1」と記述すると、</p>



<p class="is-style-sticky-red">＝VLOOKUP(検査値,範囲,列,<strong><span class="marker-animation">1</span></strong>)</p>



<p class="is-style-sticky-red">「検査値以下の数値で一番近い数字」</p>



<p>を検索することができます。</p>



<p>例えば、先ほどの画像で、データ１の得点は、64点です。<br>それに対して判定表は20点ごとに区分されています。</p>



<p>VLOOKUP(,,,1)を使うと検査値以下の数値で一番近い数字を検索してくれますので、<br>0,20,40,60,80のなかで、64に一致するとみなされるのは、<br>60となり、その行の判定結果4が返されていることがわかります。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="900" height="383" src="https://nujonoa.com/wp-content/uploads/2020/11/image-49-900x383.png" alt="" class="wp-image-7772" srcset="https://nujonoa.com/wp-content/uploads/2020/11/image-49-900x383.png 900w, https://nujonoa.com/wp-content/uploads/2020/11/image-49-500x213.png 500w, https://nujonoa.com/wp-content/uploads/2020/11/image-49-300x128.png 300w, https://nujonoa.com/wp-content/uploads/2020/11/image-49-768x327.png 768w, https://nujonoa.com/wp-content/uploads/2020/11/image-49.png 973w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<p>同様に、79点の場合、0,20,40,60,80で一番近い数字は80になりますが、<br>あくまで、<span class="marker-animation">検査値以下の数値で一番近い数字</span>を拾ってきますので、<br>一致したとみなされるのは60となります。</p>



<h3 class="wp-block-heading"><span id="toc4">注意点</span></h3>



<p>点数を小さい順から書いていく必要があり、<br>IF文では点<strong><span class="marker-animation">未満</span></strong>は○○と記載していくのに対し、<br>この方式では、点<strong><span class="marker-animation">以上</span></strong>と記述していく必要があります。</p>



<p class="is-style-sticky-yellow">IF文　　　　　　　　　VLOOKUP型<br>・20点未満は　1　→　00以上？？以下は　1<br>・40点未満は　2　→　20以上？？以下は　2<br>・60点未満は　3　→　40以上？？以下は　3<br>・80点未満は　4　→　60以上？？以下は　4<br>・80点以上は　5　→　80以上？？以下は　5</p>



<p>「０点以上では、どの人も当てはまってしまうので、<br>一つ下のセルを見ないと、上限がわからない。」</p>



<p>と、少々なれるまでに手間がかかるかと思いますが、<br>非常にきれいにまとまりますし、条件変更が簡単ですのでぜひ使ってみてください！</p>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/calculation-of-multiple-thresholds/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【エクセル】上位n個の合計値を1セルで計算する方法！</title>
		<link>https://nujonoa.com/calculate-the-total-value-of-the-top-n-points/</link>
					<comments>https://nujonoa.com/calculate-the-total-value-of-the-top-n-points/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Sun, 22 Nov 2020 14:18:00 +0000</pubDate>
				<category><![CDATA[エクセル]]></category>
		<category><![CDATA[small]]></category>
		<category><![CDATA[SUMPRODUCT]]></category>
		<category><![CDATA[LARGE]]></category>
		<category><![CDATA[n]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=7653</guid>

					<description><![CDATA[目次 上位n個の合計値を計算する方法！数式紹介数式の説明 上位n個の合計値を計算する方法！ 二八の法則といわれるように、物事は、 上位2割のものの合計が8割を占める という現象がよく起こります。そこで、上位n個の合計値を [&#8230;]]]></description>
										<content:encoded><![CDATA[

  <div id="toc" class="toc tnt-number toc-center tnt-number border-element"><input type="checkbox" class="toc-checkbox" id="toc-checkbox-20" checked><label class="toc-title" for="toc-checkbox-20">目次</label>
    <div class="toc-content">
    <ol class="toc-list open"><li><a href="#toc1" tabindex="0">上位n個の合計値を計算する方法！</a></li><li><a href="#toc2" tabindex="0">数式紹介</a></li><li><a href="#toc3" tabindex="0">数式の説明</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">上位n個の合計値を計算する方法！</span></h2>



<p>二八の法則といわれるように、<br>物事は、</p>



<p>上位2割のものの合計が8割を占める</p>



<p>という現象がよく起こります。<br>そこで、上位n個の合計値を確認し割合を確認することで<br>データの目の付け所を知ることができます。</p>



<p>そこで今回亜H、上位n個を関数で計算する方法を紹介したいとも思います。</p>



<h2 class="wp-block-heading"><span id="toc2">数式紹介</span></h2>



<p>今回紹介する数式は、<br>・SUMPRODUT<br>・ROWS<br>・INDIRECT<br>を用いて、</p>



<p class="is-style-sticky-red">=SUMPRODUCT(LARGE(データ範囲,ROW(INDIRECT("1:n"))))</p>



<p class="is-style-sticky-gray">実際の使用例<br>=SUMPRODUCT(LARGE($C$3:$C$10,ROW(INDIRECT("1:3"))))</p>



<p>と記述します。</p>



<p>計算結果は下記の通り、<br>・上位1位までの合計が、10<br>・上位2位までの合計が、18=10+8<br>・上位3位までの合計が、24=10+8+6<br>と、狙った通り計算できていることが分かります。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="900" height="333" src="https://nujonoa.com/wp-content/uploads/2020/11/image-18-900x333.png" alt="" class="wp-image-7656" srcset="https://nujonoa.com/wp-content/uploads/2020/11/image-18-900x333.png 900w, https://nujonoa.com/wp-content/uploads/2020/11/image-18-500x185.png 500w, https://nujonoa.com/wp-content/uploads/2020/11/image-18-300x111.png 300w, https://nujonoa.com/wp-content/uploads/2020/11/image-18-768x284.png 768w, https://nujonoa.com/wp-content/uploads/2020/11/image-18.png 1008w" sizes="(max-width: 900px) 100vw, 900px" /></figure>



<h2 class="wp-block-heading"><span id="toc3">数式の説明</span></h2>



<p>今回の肝となっている関数はLARGE関数です。</p>



<p>LARGE関数は</p>



<p class="is-style-sticky-red">= LARGE(data ,n ) // n番目に大きい</p>



<p>のように、使用し、n番目に大きい数字を検索することができます。</p>



<p>今回はそれにSUMPRODUCT関数を組み合わせて上位n点の合計を表現しています。</p>



<p>この数式にたどり着くイメージは、</p>



<p class="is-style-sticky-red">①簡単に記述すると、<br>= LARGE(data ,１) +LARGE(data ,2) +LARGE(data ,3) +・・・＋LARGE(data ,n) </p>



<p class="is-style-sticky-red">②上記の式をSUMPRODUCTで表現すると下記のように書くことができる。<br>=SUMPRODUCT(LARGE(data,{1,2,3,…n})</p>



<p class="is-style-sticky-red">③配列のn数が多くなると記述できなくなるので、ROWを用いて表現。<br>＝SUMPRODUCT(LARGE(data,ROW(INDIRECT("1:N")))</p>



<p>という流れになるかと思います。</p>



<p>ROW(INDIRECT("1:N")が理解しにくいかと思いますが、<br>実際セルに入力すると、下記のように1～10までの配列が作成されることが分かると思います。</p>



<figure class="wp-block-image size-large"><img loading="lazy" decoding="async" width="860" height="394" src="https://nujonoa.com/wp-content/uploads/2020/11/image-19.png" alt="" class="wp-image-7657" srcset="https://nujonoa.com/wp-content/uploads/2020/11/image-19.png 860w, https://nujonoa.com/wp-content/uploads/2020/11/image-19-500x229.png 500w, https://nujonoa.com/wp-content/uploads/2020/11/image-19-300x137.png 300w, https://nujonoa.com/wp-content/uploads/2020/11/image-19-768x352.png 768w" sizes="(max-width: 860px) 100vw, 860px" /></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/calculate-the-total-value-of-the-top-n-points/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
