<?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>マクロVBA | 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/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>マクロVBA | 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】範囲内の画像を消す方法</title>
		<link>https://nujonoa.com/vba-how-to-erase-images-in-the-range/</link>
					<comments>https://nujonoa.com/vba-how-to-erase-images-in-the-range/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Thu, 21 Apr 2022 14:09:15 +0000</pubDate>
				<category><![CDATA[マクロVBA]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=11118</guid>

					<description><![CDATA[忘備録です。 【VBA】範囲内の画像を消す方法 選択した範囲内の画像を消すプログラムになります。]]></description>
										<content:encoded><![CDATA[
<p>忘備録です。</p>



<h2 class="wp-block-heading"><strong>【VBA】範囲内の画像を消す方法</strong></h2>



<p>選択した範囲内の画像を消すプログラムになります。</p>


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


    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
    
End Sub
</pre></div>]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/vba-how-to-erase-images-in-the-range/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>VBAで「表題」はこう作る！(めんどくささ低減)</title>
		<link>https://nujonoa.com/how-to-make-a-title-in-vba/</link>
					<comments>https://nujonoa.com/how-to-make-a-title-in-vba/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Sun, 19 Dec 2021 15:03:14 +0000</pubDate>
				<category><![CDATA[マクロVBA]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=10078</guid>

					<description><![CDATA[目次 VBAで「表題」はこう作る！(めんどくささ低減)できること、やりかたテンプレートファイルのコピー 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で「表題」はこう作る！(めんどくささ低減)</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">VBAで「表題」はこう作る！(めんどくささ低減)</span></h2>



<p>VBAで、表題を作るのがとにかくめんどくさかったので、<br>簡単に表題を作ることができるような、<br>スプレッドシートのテンプレートを作成しました！！</p>



<h2 class="wp-block-heading"><span id="toc2">できること、やりかた</span></h2>



<p>できること：表題を簡単に作成することができます。</p>



<p>やり方は、非常に簡単で、そのまんまの作業をエクセルで行っているだけです。</p>



<p>なぜこんなことに１０年も気づかなかったのか。。という反省も込めて、展開させていただきます。。</p>



<figure class="wp-block-image size-full"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/12/image-13.png"><img decoding="async" width="707" height="790" src="https://nujonoa.com/wp-content/uploads/2021/12/image-13.png" alt="" class="wp-image-10162" srcset="https://nujonoa.com/wp-content/uploads/2021/12/image-13.png 707w, https://nujonoa.com/wp-content/uploads/2021/12/image-13-500x559.png 500w, https://nujonoa.com/wp-content/uploads/2021/12/image-13-300x335.png 300w" sizes="(max-width: 707px) 100vw, 707px" /></a></figure>



<h2 class="wp-block-heading"><span id="toc3">テンプレートファイルのコピー</span></h2>



<p>下記にテンプレ―トファイルを置いておきますので、<br>ご自由にお使いください。スプレッドシートをコピーできます。</p>



<div class="wp-block-cocoon-blocks-button-1 button-block"><a rel="noopener" target="_blank" href="https://docs.google.com/spreadsheets/d/17F1SxZhESWdDzfKlpxf7enfCi-vO9UzUoGyPq4kUlzE/copy" class="btn btn-l btn-circle btn-shine">テンプレートファイル<span class="fa fa-external-link external-icon anchor-icon"></span></a></div>



<p></p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/how-to-make-a-title-in-vba/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-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">階段グラフ(ウォーターフォール)のフォーマット</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 loading="lazy" 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[vba]]></category>
		<category><![CDATA[VBS]]></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-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">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】範囲内の0を空白にする方法</title>
		<link>https://nujonoa.com/vba_0_blank/</link>
					<comments>https://nujonoa.com/vba_0_blank/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Mon, 07 Jun 2021 13:51:05 +0000</pubDate>
				<category><![CDATA[マクロVBA]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=9259</guid>

					<description><![CDATA[【VBA】範囲内の0を空白にする方法 空白だと思っていても、実はセルの中に「0」が入っていたりすることがあるかと思います。 そんな時に使えるvbaが になります。 ①範囲を選択して、 ②Alt+F11 ③　「イミディエイ [&#8230;]]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading">【VBA】範囲内の0を空白にする方法</h2>



<p>空白だと思っていても、実はセルの中に「0」が入っていたりすることがあるかと思います。</p>



<p>そんな時に使えるvbaが</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
selection.Replace 0, &quot;&quot;, xlWhole
</pre></div>


<p>になります。</p>



<p>①範囲を選択して、</p>



<p>②Alt+F11</p>



<p>③　「イミディエイトウインド」に打ち込んでenterでok</p>



<figure class="wp-block-image size-large"><a rel="noopener" target="_blank" href="https://nujonoa.com/wp-content/uploads/2021/06/image-1.png"><img loading="lazy" decoding="async" width="900" height="736" src="https://nujonoa.com/wp-content/uploads/2021/06/image-1-900x736.png" alt="" class="wp-image-9491" srcset="https://nujonoa.com/wp-content/uploads/2021/06/image-1-900x736.png 900w, https://nujonoa.com/wp-content/uploads/2021/06/image-1-500x409.png 500w, https://nujonoa.com/wp-content/uploads/2021/06/image-1-300x245.png 300w, https://nujonoa.com/wp-content/uploads/2021/06/image-1-768x628.png 768w, https://nujonoa.com/wp-content/uploads/2021/06/image-1.png 954w" sizes="(max-width: 900px) 100vw, 900px" /></a></figure>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/vba_0_blank/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>【VBA】CSVの文字内の「,」を除く方法！LINE INPUT！</title>
		<link>https://nujonoa.com/comma-in-the-string-in-csv/</link>
					<comments>https://nujonoa.com/comma-in-the-string-in-csv/#respond</comments>
		
		<dc:creator><![CDATA[nujonoa]]></dc:creator>
		<pubDate>Wed, 24 Mar 2021 14:00:09 +0000</pubDate>
				<category><![CDATA[マクロVBA]]></category>
		<guid isPermaLink="false">http://nujonoa.com/?p=9159</guid>

					<description><![CDATA[目次 【VBA】CSVの文字内の「,」を除く方法！LINE INPUT！まずは再現。CSVで文字内に「,」が入るときは「"」で分けられる。プログラムの仕組みまとめ 【VBA】CSVの文字内の「,」を除く方法！LINE I [&#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">【VBA】CSVの文字内の「,」を除く方法！LINE INPUT！</a></li><li><a href="#toc2" tabindex="0">まずは再現。</a></li><li><a href="#toc3" tabindex="0">CSVで文字内に「,」が入るときは「"」で分けられる。</a></li><li><a href="#toc4" tabindex="0">プログラムの仕組み</a></li><li><a href="#toc5" tabindex="0">まとめ</a></li></ol>
    </div>
  </div>

<h2 class="wp-block-heading"><span id="toc1">【VBA】CSVの文字内の「,」を除く方法！LINE INPUT！</span></h2>



<p>VBAでCSVをLINE INPUTで読み込んだ時に、<br>文字内に「,」が含まれていると、</p>



<p>1,000 →　「１」「000」</p>



<p>のように分けられてしまいます。。</p>



<p>今回はそんなCSVの「,」の対処法を紹介したいと思います！</p>



<h2 class="wp-block-heading"><span id="toc2">まずは再現。</span></h2>



<p>まずは、SPLITで想定外の箇所まで<br>分割されてしまう事例を再現します。</p>



<p>下記のプログラムを実行すると、</p>


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

    MOJIRETSU = &quot;AAAA,BBB,&quot;&quot;1,000&quot;&quot;,10,&quot;&quot;15,000&quot;&quot;&quot;
    Debug.Print MOJIRETSU 
    
    MOJI = Split(MOJIRETSU, &quot;,&quot;)
    
    Debug.Print 0 &amp; &quot;→&quot;; MOJI(0)
    Debug.Print 1 &amp; &quot;→&quot;; MOJI(1)
    Debug.Print 2 &amp; &quot;→&quot;; MOJI(2)
    Debug.Print 3 &amp; &quot;→&quot;; MOJI(3)
    Debug.Print 4 &amp; &quot;→&quot;; MOJI(4)
    Debug.Print 5 &amp; &quot;→&quot;; MOJI(5)


End Sub
</pre></div>


<p>下記の通り、残念ながら数字の中の「,」も分割されてしまいます。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
AAAA,BBB,&quot;1,000&quot;,10,&quot;15,000&quot;
0→AAAA
1→BBB
2→&quot;1
3→000&quot;
4→10
5→&quot;15
</pre></div>


<h2 class="wp-block-heading"><span id="toc3">CSVで文字内に「,」が入るときは「"」で分けられる。</span></h2>



<p>CSVファイルで、文字内に「,」が入るときは、<br>「”(ダブルクォーテーション)」で分けられます。</p>



<p>例えば、上記のMOJIRETSUの場合、</p>



<div class="wp-block-group is-style-sticky-gray"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p>「AAAA,BBB,1,000,10,15,000」</p>
</div></div>



<p>だと、どこが区切り位置かわからないので、</p>



<div class="wp-block-group is-style-sticky-gray"><div class="wp-block-group__inner-container is-layout-flow wp-block-group-is-layout-flow">
<p>「AAAA,BBB,"1,000",10,"15,000"」</p>
</div></div>



<p>のように、「”」を使うことで、どこが区切り位置かわかるようになっています。</p>



<p>この仕組みを使って、作ったのが↓のプログラムです。<br></p>


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

Sub CSV2()

    MOJIRETSU = &quot;AAAA,BBB,&quot;&quot;1,000&quot;&quot;,10,&quot;&quot;15,000&quot;&quot;&quot;
    
    
    F = InStr(1, MOJIRETSU, &quot;&quot;&quot;&quot;)
    If F &gt; 0 Then
LABEL1:
        S = InStr(F + 1, MOJIRETSU, &quot;&quot;&quot;&quot;)
        
        MOJI1 = Left(MOJIRETSU, F - 1)
        MOJI2 = Mid(Replace(MOJIRETSU, &quot;,&quot;, &quot;_&quot;), F + 1, S - F - 1)
        MOJI3 = Right(MOJIRETSU, Len(MOJIRETSU) - S)
        
        MOJIRETSU = MOJI1 &amp; MOJI2 &amp; MOJI3
        
        F = InStr(1, MOJIRETSU, &quot;&quot;&quot;&quot;)
        If F &gt; 0 Then GoTo LABEL1
        
    End If
    
    
    MOJI = Split(MOJIRETSU, &quot;,&quot;)
    
    Debug.Print MOJIRETSU 'AAAA,BBB,&quot;1,000&quot;,10,&quot;15,000&quot;
    Debug.Print 0 &amp; &quot;→&quot;; MOJI(0)
    Debug.Print 1 &amp; &quot;→&quot;; MOJI(1)
    Debug.Print 2 &amp; &quot;→&quot;; MOJI(2)
    Debug.Print 3 &amp; &quot;→&quot;; MOJI(3)
    Debug.Print 4 &amp; &quot;→&quot;; MOJI(4)
    

End Sub

</pre></div>


<p>この実行結果は、下記の通り、思った通りの場所で分割できていることが分かります。</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
AAAA,BBB,1_000,10,15_000
0→AAAA
1→BBB
2→1_000
3→10
4→15_000
</pre></div>


<p></p>



<h2 class="wp-block-heading"><span id="toc4">プログラムの仕組み</span></h2>



<p>仕組みとしては、本当に単純で、</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
F = InStr(1, MOJIRETSU, &quot;&quot;&quot;&quot;)
</pre></div>

<div class="wp-block-syntaxhighlighter-code "><pre class="brush: vb; title: ; notranslate">
S = InStr(F + 1, MOJIRETSU, &quot;&quot;&quot;&quot;)
</pre></div>


<p><br>で、1つ目の「”」と、2つ目の「”」の位置を調べて、</p>


<div class="wp-block-syntaxhighlighter-code "><pre class="brush: plain; title: ; notranslate">
    MOJI1 = Left(MOJIRETSU, F - 1)
    MOJI2 = Mid(Replace(MOJIRETSU, &quot;,&quot;, &quot;_&quot;), F + 1, S - F - 1)
    MOJI3 = Right(MOJIRETSU, Len(MOJIRETSU) - S)

    MOJIRETSU = MOJI1 &amp; MOJI2 &amp; MOJI3
</pre></div>


<p>で、<br>・「”」の左までの文字列<br>・「”」「”」の間の[,]を[_]に変えた文字列<br>・「”」の右の文字列<br>を取り出して合体させています。</p>



<p>あとは、これを繰り返して、「”」がなくなるまで繰り返して終わりです。</p>



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



<p>他の人のやり方を見ると、別で関数を作っていたのですが、<br>強引に作ってみました。笑</p>



<p>残念ながら文字列に「"」が入ってくるとどうもならなくなりますが、、、<br>「,」しかない場合は、このプログラムを使ってみてください！</p>
]]></content:encoded>
					
					<wfw:commentRss>https://nujonoa.com/comma-in-the-string-in-csv/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
