Clear data rows before CSV import

This commit is contained in:
updsv7
2026-04-13 11:55:11 +09:00
parent 68a65eecfb
commit 65ad779d6d

View File

@@ -146,6 +146,12 @@ Sub ImportMasterDetailData()
lines = Split(textContent, vbCrLf)
' === Clear all data rows before import ===
lastRow = wsTarget.Cells(wsTarget.Rows.Count, "C").End(xlUp).Row
If lastRow >= 7 Then
wsTarget.Range("A7:P" & lastRow).ClearContents
End If
If UBound(lines) < 1 Then
MsgBox "No data in CSV.", vbExclamation
Exit Sub