2,462
社区成员
发帖
与我相关
我的任务
分享
Private mblnUpdating As Boolean
Private Sub Worksheet_Change(ByVal Target As Range)
If mblnUpdating Then
Exit Sub
End If
mblnUpdating = True
Dim strContent As String
strContent = Target.Text
Dim strTemp As String
For i = 1 To Len(strContent)
strTemp = strTemp & Mid(strContent, i, 1)
If i Mod 10 = 0 Then
SetCellValue Target.Row, Target.Column + (i \ 10) - 1, strTemp
strTemp = ""
End If
Next
If strTemp <> "" Then
SetCellValue Target.Row, Target.Column + ((i - 1) \ 10), strTemp
End If
mblnUpdating = False
End Sub
Private Sub SetCellValue(ByVal intRow As Integer, ByVal intColumn As Integer, ByVal strValue As String)
Dim objRange As Range
Set objRange = Cells(intRow, intColumn)
objRange.NumberFormatLocal = "@"
objRange = strValue
End Sub