Clear data rows before CSV import
This commit is contained in:
@@ -146,6 +146,12 @@ Sub ImportMasterDetailData()
|
|||||||
|
|
||||||
lines = Split(textContent, vbCrLf)
|
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
|
If UBound(lines) < 1 Then
|
||||||
MsgBox "No data in CSV.", vbExclamation
|
MsgBox "No data in CSV.", vbExclamation
|
||||||
Exit Sub
|
Exit Sub
|
||||||
|
|||||||
Reference in New Issue
Block a user