Boa noite! Estou desenvolvendo um formulário de cadastro e estou tendo problemas com meu código pois ficou muito longo e demora um pouquinho para iniciar, agradeço se tiverem uma ideia melhor ou uma forma de deixar mais rápido.... segue:
(Foi proposital usar label como destino final de dados)
____________________________________
Private Sub BtnVerificar_Click()
Call Verificar1
Call Verificar2
Call Verificar3
.
.
.
Call Verificar10
End Sub
____________________________________
Sub Verificar1()
Sheets("Planilha1").Activate
linha = Range("A2").End(xlDown).Row + 1
lin = 2
While lin < linha
If Cells(lin, 3) = "1" Then
UserForm1.Q1.Caption = "Indisponivel"
Exit Sub
End If
lin = lin + 1
Wend
UserForm1.Q1.Caption = "Disponivel"
End Sub
_______________________________________
Sub Verificar2()
Sheets("Planilha1").Activate
linha = Range("A2").End(xlDown).Row + 1
lin = 2
While lin < linha
If Cells(lin, 3) = "2" Then
UserForm1.Q2.Caption = "Indisponivel"
Exit Sub
End If
lin = lin + 1
Wend
UserForm1.Q2.Caption = "Disponivel"
End Sub
______________________________________
Sub Verificar3()
Sheets("Planilha1").Activate
linha = Range("A2").End(xlDown).Row + 1
lin = 2
While lin < linha
If Cells(lin, 3) = "3" Then
UserForm1.Q3.Caption = "Indisponivel"
Exit Sub
End If
lin = lin + 1
Wend
UserForm1.Q3.Caption = "Disponivel"
End Sub