0

For the Else statement, can I ask if how can I make the coLRN be like 0003? The result of the this line txtBox_LRN.Text = "NS" & Year(Date) & coLRN in the code is NS20213 where 3 is the count of coLRN. I just need to make the 3 be like 0003.

Dim srch As String
srch = "*" & "NS" & Year(Date) & "*"
coLRN = Application.CountIf(Worksheets("STUDENTS_INFO").Columns(3), srch)
                
  If coLRN = 0 Then
     txtBox_LRN.Text = "NS" & Year(Date) & "0001"
  Else
     txtBox_LRN.Text = "NS" & Year(Date) & coLRN
 End If
cjvdg
  • 497
  • 2
  • 15

0 Answers0