瀏覽單個文章
ccx1103
Regular Member
 

加入日期: Aug 2005
文章: 72
公式可以解決的問題,應該使用公式。
VBA沒有比較聰明。

Sub xxx()

Set currgn = ActiveCell.CurrentRegion
Set c = currgn.Find("*姓*名*")
If Not c Is Nothing Then
Range(c.Address).Offset(1, 0).Select
Else
Exit Sub
End If

While ActiveCell.Value <> ""
If ActiveCell.Offset(0, 1).Value <> "" Then
ActiveCell.Offset(0, -1).Value = Right(ActiveCell.Offset(0, 1).Value, 5)
End If

If ActiveCell.Offset(0, 2).Value <> "" Then
ActiveCell.Offset(0, -1).Value = Right(ActiveCell.Offset(0, 2).Value, 5)
End If

ActiveCell.Offset(1, 0).Select
Wend

End Sub
舊 2012-11-03, 02:45 PM #3
回應時引用此文章
ccx1103離線中