投稿日 | : 2003/10/07(Tue) 09:14 |
投稿者 | : hiro |
URL | : |
タイトル | : 文字の抽出です |
こんにちは。Instr関数を使って"/"までの分と/以降は+1するソースの一部です。
ですが、これが昨日から考えても機能せず。なにがおかしいのでしょうか??
Public Sub Enter()
col = ActiveCell.Column
row = ActiveCell.row
SNprev = Cells(row - 1, col).Value
If (row > 2) Then
If Len(SNprev) = 19 And Val(SNprev) > 0 Then
strSN1 = Left(SNprev, InStr(1, SNprev, "/") - 1)
strSN2 = Right(SNprev, 2)
strSN2 = CStr(CInt(strSN2) + 1)
strSN2 = Application.Text(strSN2, "000")
If Len(strSN2) > 4 Then End
SNNew = strSN1 & "/" & strSN2
Cells(row + 1, col) = SNNew
出来ればおかしい部分を指摘して下さい。お願いします。