Convert Chinese comments to English
This commit is contained in:
@@ -1,11 +1,11 @@
|
||||
Private Sub Worksheet_Change(ByVal Target As Range)
|
||||
' === G列变化时生成F列下拉列表(匹配冒号左边) ===
|
||||
' === Generate F dropdown based on G column (matching left of colon) ===
|
||||
If Target.Column = 7 And Target.Row >= 7 Then
|
||||
If Target.Count > 1 Then Exit Sub
|
||||
Call MakeFDropdownByG(Me, Target.Row)
|
||||
End If
|
||||
|
||||
' === F列变化时提取冒号左边到G列 ===
|
||||
' === Extract left of colon to G column when F changes ===
|
||||
If Target.Column = 6 And Target.Row >= 7 Then
|
||||
If Target.Count > 1 Then Exit Sub
|
||||
If Trim(Target.Value) <> "" Then
|
||||
@@ -18,7 +18,7 @@ Private Sub Worksheet_Change(ByVal Target As Range)
|
||||
End If
|
||||
End If
|
||||
|
||||
' === C列变化时填充D、E ===
|
||||
' === Fill D, E when C column changes ===
|
||||
If Target.Column = 3 And Target.Row >= 7 Then
|
||||
If Target.Count > 1 Then
|
||||
' Handle multiple cells
|
||||
@@ -147,7 +147,7 @@ Sub ImportMasterDetailData()
|
||||
lines = Split(textContent, vbCrLf)
|
||||
|
||||
If UBound(lines) < 1 Then
|
||||
MsgBox "CSVにデータがありません。", vbExclamation
|
||||
MsgBox "No data in CSV。", vbExclamation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -169,7 +169,7 @@ NextCsvLine:
|
||||
Next i
|
||||
|
||||
If csvData.Count = 0 Then
|
||||
MsgBox "有効なコードが見つかりません。", vbExclamation
|
||||
MsgBox "No valid code found。", vbExclamation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
@@ -200,7 +200,7 @@ NextCsvLine:
|
||||
' Auto-fill D, E columns from 区間メンテナンス
|
||||
Call FillFromKukanMaster(wsTarget, writeRow, False)
|
||||
|
||||
' G列已有值 → 触发F下拉列表
|
||||
' G column has value → trigger F dropdown
|
||||
If Trim(wsTarget.Cells(writeRow, 7).Value) <> "" Then
|
||||
Call MakeFDropdownByG(wsTarget, writeRow)
|
||||
End If
|
||||
@@ -209,7 +209,7 @@ NextCsvLine:
|
||||
NextLine:
|
||||
Next i
|
||||
|
||||
MsgBox writeRow - 7 & " 行を取り込みました。", vbInformation
|
||||
MsgBox writeRow - 7 & " rows imported。", vbInformation
|
||||
End Sub
|
||||
|
||||
Function CleanCSVField(ByVal field As Variant) As String
|
||||
@@ -282,11 +282,11 @@ Sub ClearRowData(ByVal ws As Worksheet, ByVal rowNum As Long)
|
||||
' Clear from D column onwards
|
||||
ws.Range(ws.Cells(rowNum, 4), ws.Cells(rowNum, 15)).ClearContents
|
||||
ws.Cells(rowNum, 6).Validation.Delete
|
||||
ws.Cells(rowNum, 17).ClearContents ' Q列错误信息
|
||||
ws.Cells(rowNum, 17).ClearContents ' Q column error info
|
||||
End Sub
|
||||
|
||||
Sub validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long, Optional ByVal isImport As Boolean = False)
|
||||
' 关闭屏幕刷新和事件提升性能
|
||||
' Disable screen update and calculation for performance
|
||||
Application.ScreenUpdating = False
|
||||
Application.Calculation = xlCalculationManual
|
||||
|
||||
@@ -311,7 +311,7 @@ Sub validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long, Optional ByV
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' === J列和K列必须为数字(不能为空) ===
|
||||
' === J and K columns must be numeric (required) ===
|
||||
jValue = Trim(ws.Cells(rowNum, 10).Value)
|
||||
kValue = Trim(ws.Cells(rowNum, 11).Value)
|
||||
|
||||
@@ -322,7 +322,7 @@ Sub validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long, Optional ByV
|
||||
End If
|
||||
|
||||
If Not IsNumeric(jValue) Then
|
||||
errorMsg = "J列には数値を入力してください。"
|
||||
errorMsg = "J列must be numeric。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -334,12 +334,12 @@ Sub validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long, Optional ByV
|
||||
End If
|
||||
|
||||
If Not IsNumeric(kValue) Then
|
||||
errorMsg = "K列には数値を入力してください。"
|
||||
errorMsg = "K列must be numeric。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' === L、M、N、O、P列如果输入必须为数字 ===
|
||||
' === L, M, N, O, P columns must be numeric if entered ===
|
||||
lValue = Trim(ws.Cells(rowNum, 12).Value)
|
||||
mValue = Trim(ws.Cells(rowNum, 13).Value)
|
||||
nValue = Trim(ws.Cells(rowNum, 14).Value)
|
||||
@@ -347,36 +347,36 @@ Sub validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long, Optional ByV
|
||||
pValue = Trim(ws.Cells(rowNum, 16).Value)
|
||||
|
||||
If lValue <> "" And Not IsNumeric(lValue) Then
|
||||
errorMsg = "L列には数値を入力してください。"
|
||||
errorMsg = "L列must be numeric。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If mValue <> "" And Not IsNumeric(mValue) Then
|
||||
errorMsg = "M列には数値を入力してください。"
|
||||
errorMsg = "M列must be numeric。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If nValue <> "" And Not IsNumeric(nValue) Then
|
||||
errorMsg = "N列には数値を入力してください。"
|
||||
errorMsg = "N列must be numeric。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If oValue <> "" And Not IsNumeric(oValue) Then
|
||||
errorMsg = "O列には数値を入力してください。"
|
||||
errorMsg = "O列must be numeric。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If pValue <> "" And Not IsNumeric(pValue) Then
|
||||
errorMsg = "P列には数値を入力してください。"
|
||||
errorMsg = "P列must be numeric。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
' === G、H、I列联合主键检查重复 ===
|
||||
' === Check G, H, I composite key for duplicates ===
|
||||
gValue = Trim(ws.Cells(rowNum, 7).Value)
|
||||
hValue = Trim(ws.Cells(rowNum, 8).Value)
|
||||
iValue = Trim(ws.Cells(rowNum, 9).Value)
|
||||
@@ -390,7 +390,7 @@ Sub validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long, Optional ByV
|
||||
If Trim(ws.Cells(i, 7).Value) = gValue And _
|
||||
Trim(ws.Cells(i, 8).Value) = hValue And _
|
||||
Trim(ws.Cells(i, 9).Value) = iValue Then
|
||||
errorMsg = "GHI列の組が既に存在します。"
|
||||
errorMsg = "GHI列combination already exists。"
|
||||
ws.Cells(rowNum, 17).Value = errorMsg
|
||||
Exit Sub
|
||||
End If
|
||||
@@ -399,16 +399,16 @@ Sub validateDetailData(ByVal ws As Worksheet, ByVal rowNum As Long, Optional ByV
|
||||
Next i
|
||||
End If
|
||||
|
||||
' 验证通过,清除Q列错误信息
|
||||
' Validation passed, clear Q column error
|
||||
ws.Cells(rowNum, 17).Value = ""
|
||||
|
||||
' 恢复设置
|
||||
' Restore settings
|
||||
Application.ScreenUpdating = True
|
||||
Application.Calculation = xlCalculationAutomatic
|
||||
|
||||
End Sub
|
||||
|
||||
' 按钮调用的宏(验证当前选中行)
|
||||
' 按钮调用的宏(Validate selected row)
|
||||
Sub validateDetailDataButton()
|
||||
Dim rowNum As Long
|
||||
rowNum = ActiveCell.Row
|
||||
@@ -429,14 +429,14 @@ Sub ExportMasterDetailData()
|
||||
lastDataRow = ws.Cells(ws.Rows.Count, "C").End(xlUp).Row
|
||||
|
||||
If lastDataRow < 7 Then
|
||||
MsgBox "出力するデータ行がありません。", vbExclamation
|
||||
MsgBox "No data rows to output。", vbExclamation
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim savePath As String
|
||||
savePath = Application.GetSaveAsFilename( _
|
||||
FileFilter:="CSV Files (*.csv), *.csv", _
|
||||
Title:="CSV保存")
|
||||
Title:="Save CSV")
|
||||
|
||||
If savePath = "False" Then Exit Sub
|
||||
If InStr(1, savePath, ".csv", vbTextCompare) = 0 Then
|
||||
@@ -481,5 +481,5 @@ Sub ExportMasterDetailData()
|
||||
stream.SaveToFile savePath, 2
|
||||
stream.Close
|
||||
|
||||
MsgBox "CSV出力が完了しました。", vbInformation
|
||||
MsgBox "CSV export completed。", vbInformation
|
||||
End Sub
|
||||
Reference in New Issue
Block a user