美好的一天,
我有这个生成唯一ID的按钮,但在执行之前,我想要一个新窗口,询问用户将在" A20"中添加多少行,然后生成ID的代码将执行添加特定行后。
以下是生成ID的代码:
Private Sub CommandButton1_Click()
Dim x As String, rcell As Range, y As String, z As Long
x = "RFP" & Format(Now, "mmddyyhhmmss")
y = Left(x, 10)
z = Right(x, 2)
For Each rcell In Range("D20:D" & Range("D" & Rows.Count).End(3).Row)
If Cells(rcell.Row, 4) = "" Then Cells(rcell.Row, 4) = y & z
z = z + 1
Next rcell
End Sub
提前感谢您对任何输入表示高度赞赏