<?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>If文</title>
	<atom:link href="https://office-automation-lab.com/tag/if%e6%96%87/feed/" rel="self" type="application/rss+xml" />
	<link>https://office-automation-lab.com</link>
	<description>AIとExcelで仕事を少しだけ楽にする方法を、リアルな体験と検証で発信</description>
	<lastBuildDate>Mon, 15 Jun 2026 16:28:47 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>

<image>
	<url>https://office-automation-lab.com/wp-content/uploads/2026/06/cropped-サイト画像-32x32.jpg</url>
	<title>If文</title>
	<link>https://office-automation-lab.com</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>VBAでチェックボックスにチェックが入ったら別シートへ転記するコード（If文）｜データ管理を自動化する方法</title>
		<link>https://office-automation-lab.com/vba-transfer-checked-data-to-another-sheet/</link>
					<comments>https://office-automation-lab.com/vba-transfer-checked-data-to-another-sheet/#respond</comments>
		
		<dc:creator><![CDATA[mkhome_ai]]></dc:creator>
		<pubDate>Mon, 15 Jun 2026 16:28:47 +0000</pubDate>
				<category><![CDATA[VBAコード集]]></category>
		<category><![CDATA[Excel VBA]]></category>
		<category><![CDATA[If文]]></category>
		<category><![CDATA[VBA]]></category>
		<category><![CDATA[チェックボックス]]></category>
		<category><![CDATA[データ転記]]></category>
		<category><![CDATA[別シート転記]]></category>
		<category><![CDATA[案件管理]]></category>
		<category><![CDATA[業務効率化]]></category>
		<guid isPermaLink="false">https://office-automation-lab.com/?p=660</guid>

					<description><![CDATA[・入力フォームの内容をデータベースへ登録できる・チェックが入ったデータだけ別シートへ転記できる・VBA初心者でもコピペで利用可能 このコードでできること ・入力フォームの内容をSheet2へ登録・チェック済みデータのみS [&#8230;]]]></description>
										<content:encoded><![CDATA[
<p class="wp-block-paragraph">・入力フォームの内容をデータベースへ登録できる<br>・チェックが入ったデータだけ別シートへ転記できる<br>・VBA初心者でもコピペで利用可能</p>



<h2 class="wp-block-heading">このコードでできること</h2>



<p class="wp-block-paragraph">・入力フォームの内容をSheet2へ登録<br>・チェック済みデータのみSheet3へ転記<br>・完了案件と未完了案件を自動で振り分け</p>



<h3 class="wp-block-heading">VBAコード</h3>



<pre class="wp-block-code"><code>Sub 登録処理()

    Dim wsForm As Worksheet
    Dim ws2 As Worksheet
    Dim ws3 As Worksheet
    Dim nextRow2 As Long
    Dim nextRow3 As Long

    Set wsForm = Worksheets("案件入力フォーム") ' 入力フォーム
    Set ws2 = Worksheets("案件データベース")
    Set ws3 = Worksheets("新規登録名簿")

    ' Sheet2へ転記（必ず）
    nextRow2 = ws2.Cells(ws2.Rows.Count, 1).End(xlUp).Row + 1

    ws2.Cells(nextRow2, 1).Value = wsForm.Range("C2").Value '案件名
    ws2.Cells(nextRow2, 2).Value = wsForm.Range("C3").Value '顧客名
    ws2.Cells(nextRow2, 3).Value = wsForm.Range("C4").Value '担当者
    ws2.Cells(nextRow2, 4).Value = wsForm.Range("C5").Value '受注日
    ws2.Cells(nextRow2, 5).Value = wsForm.Range("C6").Value '金額
    ws2.Cells(nextRow2, 6).Value = wsForm.Range("C7").Value 'ステータス
    ws2.Cells(nextRow2, 7).Value = wsForm.Range("C8").Value '備考

    ' 完了チェックがある場合のみSheet3へ
    If wsForm.Range("C9").Value = "1" Then

        nextRow3 = ws3.Cells(ws3.Rows.Count, 1).End(xlUp).Row + 1

        ws3.Rows(nextRow3).Value = ws2.Rows(nextRow2).Value

    End If

End Sub</code></pre>



<h2 class="wp-block-heading">カスタマイズ例</h2>



<h3 class="wp-block-heading">パターン①</h3>



<p class="wp-block-paragraph">完了以外に「保留」も転記する</p>



<pre class="wp-block-code"><code>If wsForm.Range("C9").Value = "1" Or wsForm.Range("C7").Value = "保留" Then

    nextRow3 = ws3.Cells(ws3.Rows.Count, 1).End(xlUp).Row + 1

    ws3.Rows(nextRow3).Value = ws2.Rows(nextRow2).Value

End If</code></pre>



<h3 class="wp-block-heading">パターン②</h3>



<p class="wp-block-paragraph">チェックが入ったらメッセージを表示する</p>



<pre class="wp-block-code"><code>If wsForm.Range("C9").Value = "1" Then

    nextRow3 = ws3.Cells(ws3.Rows.Count, 1).End(xlUp).Row + 1

    ws3.Rows(nextRow3).Value = ws2.Rows(nextRow2).Value

    MsgBox "完了案件を転記しました"

End If</code></pre>



<h2 class="wp-block-heading">よくあるエラー</h2>



<h3 class="wp-block-heading">症状</h3>



<p class="wp-block-paragraph">チェックを入れても「新規登録名簿」へ転記されない</p>



<p class="wp-block-paragraph">対処法<br>・C9セルが「☑」になっているか確認<br>・参照セルが変更されていないか確認</p>



<h3 class="wp-block-heading">症状</h3>



<p class="wp-block-paragraph">実行時エラー「インデックスが有効範囲にありません」</p>



<p class="wp-block-paragraph">対処法<br>・シート名を確認する<br>・「案件入力フォーム」「案件データベース」「新規登録名簿」が存在するか確認する</p>



<h2 class="wp-block-heading">サンプルファイル</h2>



<p class="wp-block-paragraph">このコードを試せるサンプルファイルを配布しています。</p>



<p class="wp-block-paragraph">▶ <a target="_blank" href="https://office-automation-lab.com/wp-content/uploads/2026/06/案件管理システム_3_VBAサンプル.zip">サンプルファイルをダウンロード（.zip）</a></p>



<h2 class="wp-block-heading">関連記事</h2>



<p class="wp-block-paragraph">▶ <a target="_blank" href="https://office-automation-lab.com/vba-project-registration/" data-type="link" data-id="https://office-automation-lab.com/vba-project-registration/">VBAで入力フォームの内容を別シートへ登録するコード</a></p>



<p class="wp-block-paragraph">▶ <a target="_blank" href="https://office-automation-lab.com/vba-clear-project-entry-form/" data-type="link" data-id="https://office-automation-lab.com/vba-clear-project-entry-form/">VBAで入力フォームを自動クリアするコード</a></p>



<p class="wp-block-paragraph">▶ <a target="_blank" href="https://office-automation-lab.com/vba-practical-checkbox/" data-type="link" data-id="https://office-automation-lab.com/vba-practical-checkbox/">VBAで疑似チェックボックスを作成する方法</a></p>



<h2 class="wp-block-heading">次回予告</h2>



<p class="wp-block-paragraph">次回は「VBAで担当者別にデータを集計するコード」を紹介予定です。</p>



<p class="wp-block-paragraph"></p>
]]></content:encoded>
					
					<wfw:commentRss>https://office-automation-lab.com/vba-transfer-checked-data-to-another-sheet/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
