|
▼sp さん:
Sub Macro1()
'
' Macro1 Macro
'
'
Dim Tokuisaki As String
Dim Hizuke_Count As Integer
Dim Meisai_gyou As Integer
Tokuisaki = ""
Hizuke_Count = 0
Meisai_gyou = 0
Sheet1.Cells(1, 1).Select
For i = 1 To Sheet1.Cells(Rows.Count, ActiveCell.Column).End(xlUp).Row
If Sheet1.Cells(i, 4).Value = Tokuisaki Then
Meisai_gyou = Meisai_gyou + 1
Sheet1.Cells(i, 1).Value = Sheet1.Cells(i, 1).Value + 10
Sheet1.Cells(i, 2).Value = Format(Date, "yyyy/mm/dd") & Format(Hizuke_Count, "000")
Sheet1.Cells(i, 3).Value = "'" + Format(Meisai_gyou, "000")
Else
Tokuisaki = Sheet1.Cells(i, 4).Value
Hizuke_Count = Hizuke_Count + 1
Meisai_gyou = 1
Sheet1.Cells(i, 1).Value = Sheet1.Cells(i, 1).Value + 10
Sheet1.Cells(i, 2).Value = Format(Date, "yyyy/mm/dd") & Format(Hizuke_Count, "000")
Sheet1.Cells(i, 3).Value = "'" + Format(Meisai_gyou, "000")
End If
Next i
End Sub
こんな感じで、どうでしょうか。
|
|