作者:乔山办公网日期:
返回目录:excel表格制作
解决办法百如下度:
Private Sub Worksheet_SelectionChange(ByVal Target As Range)
If Target.Column > 5 Then
Cells(Target.Row + 1, 1).Select
End If
End Sub
上面是知>5,即数据输到道E列,再往右回就会换答行。
Private Sub Worksheet_Change(ByVal Target As Range)
r = Target.Row
If Len(Cells(r, 5)) > 0 And Target.Column < 5 Then
Application.EnableEvents = False
If Len(Cells(r + 1, 1)) = 0 Then
Cells(r + 1, 1) = Cells(r, 5)
Cells(r, 5) = ""
Application.EnableEvents = True
Else
If Len(Cells(r + 1, 4)) = 0 Then
Range("A" & r + 1).Insert xlShiftToRight
Cells(r + 1, 1) = Cells(r, 5)
Cells(r, 5) = ""
Application.EnableEvents = True
Else
Range("A" & r + 1).Insert xlShiftToRight
Application.EnableEvents = True
Cells(r + 1, 1) = Cells(r, 5)
Cells(r, 5) = ""
End If
End If
End If
End Sub
不用vba可以吗?将单元格内容复制到记事本中,然后再粘贴回excel中就可以了
选中要进行处理的zd这个单元格版,运行下面权的宏。
Sub 分行()
x = Selection.Value
For i = 1 To Len(x) Step 3
y = y & Mid(x, i, 3) & vbCrLf
Next i
Selection.Value = y
End Sub