|
供参考,代码写的不会有重号的
Private Sub CommandButton1_Click()
Dim nmb$
nmb = Sheet2.Cells(Sheet2.Range("A" & Rows.Count).End(xlUp).Row, 1)
If Mid(nmb, 4, 8) = Format(Date, "yyyymmdd") Then
Sheet1.[A1] = Left(nmb, 12) & Format(Val(Right(nmb, 2)) + 1, "00")
Else
Sheet1.[A1] = Left(nmb, 3) & Format(Date, "yyyymmdd") & "-01"
End If
End Sub
Private Sub CommandButton2_Click()
If Sheet2.Cells(Sheet2.Range("A" & Rows.Count).End(xlUp).Row, 1) = Sheet1.[A1] Then Exit Sub
Sheet2.Cells(Sheet2.Range("A" & Rows.Count).End(xlUp).Row + 1, 1) = Sheet1.[A1]
End Sub
|
|