然后在userform上,我希望当我更改章节时,编号部分自动更新,如果在工作表上,第1章最后编号是1,那么userform上的编号会自动更新为2,然后与第2章和第3章。
这就是我的尝试:
Dim label As Control
For ctr = 1 To InfoForm.Chapter.ListCount - 1
For Each label In InfoForm.Controls
If TypeName(label) = "Label" Then
i = i + 1
Dim WhatChapter As String
WhatChapter = InfoForm.Chapter
lastNum = Cells(.Rows.Count, "A").End(xlUp).Row
If WhatChapter = "Chapter " & ctr Then
If Cells(lastNum, i).Value = "No." Then
Num.Value = 1
Else
Num.Value = Cells(lastNum, i).Value
End If
End If
End If
Next
Next ctr