Ir para conteúdo
Fórum Script Brasil
  • 0

Ajuda com UserForm apresentando erro


Fernando M F

Pergunta

Boa tarde.

Sou noob em vba para excel. Gostaria que alguém pudesse me ajudar neste código. Fui criando ele no estilo frankstein. Copiando várias rotinas prontas e adaptando. Se puderem depurar e tentar executar essa userform e me relatar os erros e sugerir as alterações cabíveis ficarei grato. Segue abaixo o código:

 

 

Private Sub Cbo_Condutor_Change()
If Not IsNumeric(Cbo_Condutor.Text) Then
Sheets("Dados iniciais").Select
Cells(3, 2).Value = Me.Cbo_Condutor.Text
Else

End If

End Sub

Private Sub Cbo_Isolador_Tipo_Change()
Sheets("Dados iniciais").Select
Cells(11, 3).Value = Me.Cbo_Isolador_Tipo.Text
Call mostra_peso_cadeia
Call mostra_comprimento_cadeia
End Sub


Private Sub Cbo_Tensao_Change()
Dim ld As String

If Not IsNumeric(Cbo_Tensao.Text) Then
Cbo_Tensao.Text = ""
MsgBox ("Entre somente com valores numéricos")
Else

If Me.Cbo_Tensao.Text = 69 Then
Cbo_Tensao.Text = " 69"
Sheets("Dados iniciais").Select
Cells(10, 3).Value = Me.Cbo_Tensao.Text
Call mostra_peso_cadeia
Call mostra_comprimento_cadeia

Else
Sheets("Dados iniciais").Select
Cells(10, 3).Value = Me.Cbo_Tensao.Text
Call mostra_peso_cadeia
Call mostra_comprimento_cadeia

ld = Right(txtbox_nome_ld.Text, 2)
If Not ld = "kV" Then
Else

txtbox_nome_ld = Left(txtbox_nome_ld, Len(txtbox_nome_ld) - 8)
txtbox_nome_ld = txtbox_nome_ld.Text
txtbox_nome_ld = txtbox_nome_ld.Text & ", " & Cbo_Tensao.Text & " kV"

End If
End If
End If

End Sub
Private Sub CommandButton_editar_bd_Click()
Dim pass As String

pass = InputBox("Entre com a senha do administrador")
If pass = "123" Then
Unload UserForm1

Else

MsgBox ("senha errada, tente novamente")

End If
'
End Sub
Private Sub CommandButton1_Click()
Dim i As Integer
Dim j As Double
j = 1E-40

'On Error GoTo errorhandler
'Vai para a aba Dados iniciais
Sheets("Dados iniciais").Select

If (txtbox_qtd_vaos_re.Text > 0) And (txtbox_qtd_vaos_vante.Text = 0) Then
'Reseta os valores
Cells(93, 2) = Cells(92, 2).Value - j

'Roda a rotina meta9999
Range("B99").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B93")


While (Cells(93, 2) < 0) Or (Cells(93, 2) > Cells(92, 2))
Cells(93, 2) = Cells(92, 2).Value - j
Range("B99").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B93")
j = j * 10
Wend

Else

If (txtbox_qtd_vaos_re.Text = 0) And (txtbox_qtd_vaos_vante.Text > 0) Then
'Reseta os valores
Cells(94, 2) = Cells(92, 2).Value - j

'Roda a rotina meta9999
Range("B100").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B94")


While (Cells(94, 2) < 0) Or (Cells(94, 2) > Cells(92, 2))
Cells(94, 2) = Cells(92, 2).Value - j
Range("B100").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B94")
j = j * 10
Wend

Else

If (txtbox_qtd_vaos_re.Text > 0) And (txtbox_qtd_vaos_vante.Text > 0) Then
'Reseta os valores
Cells(93, 2) = Cells(92, 2).Value - j

'Roda a rotina meta9999
Range("B99").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B93")

While Cells(93, 2) < 0 Or Cells(93, 2) > Cells(92, 2)
Cells(93, 2) = Cells(92, 2).Value - j
Range("B99").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B93")
j = j * 10
Wend

j = 1E-40

Cells(94, 2) = Cells(92, 2).Value - j
Range("B100").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B94")

While Cells(94, 2) < 0 Or Cells(94, 2) > Cells(92, 2)
Cells(94, 2) = Cells(92, 2).Value - j
Range("B100").GoalSeek Goal:=Range("B98").Value, ChangingCell:=Range("B94")
j = j * 10
Wend

End If
End If
End If


Sheets("Dados iniciais").Select
txtbox_constante_catenaria_pos_rompimento.Text = Cells(102, 2).Text
txtbox_constante_catenaria_pos_rompimento.Text = Format(txtbox_constante_catenaria_pos_rompimento, "#,##0.00")
           
Sheets("Dados iniciais").Select
txtbox_tracao_pos_rompimento.Text = Cells(101, 2).Text
txtbox_tracao_pos_rompimento.Text = Format(txtbox_tracao_pos_rompimento, "#,##0.00")


'Exit Sub
'errorhandler: MsgBox ("Falta dado")

End Sub


Private Sub TextBox38_Change()
If Not IsNumeric(txtbox_vao_7_re.Text) Then txtbox_vao_7_re.Text = ""
Sheets("Dados iniciais").Select
Cells(15, 3).Value = Me.txtbox_vao_7_re.Text
End Sub

Private Sub TextBox60_Change()
Sheets("Dados iniciais").Select
Me.txtbox_tracao_antes_rompimento.Text = Cells(92, 2).Value
End Sub


Private Sub TextBox64_Change()

End Sub

Private Sub TextBox9_Change()

End Sub

Private Sub txtbox_comprimento_cadeia_Change()
Sheets("Isoladores").Select
Cells(8, 4).Value = Me.txtbox_comprimento_cadeia.Text
Sheets("Dados iniciais").Select
End Sub

Private Sub txtbox_estrutura_1_re_Change()
If Not IsNumeric(txtbox_estrutura_1_re.Text) Then
If txtbox_estrutura_1_re = "" Then
txtbox_estrutura_1_re = ""
Sheets("Dados iniciais").Select
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text
Else
txtbox_estrutura_1_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text
End If
End Sub

Private Sub txtbox_estrutura_1_vante_Change()
If Not IsNumeric(txtbox_estrutura_1_vante.Text) Then
If txtbox_estrutura_1_vante = "" Then
txtbox_estrutura_1_vante = ""
Sheets("Dados iniciais").Select
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text
Else
txtbox_estrutura_1_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text
End If
End Sub

Private Sub txtbox_estrutura_3_vante_Change()
If Not IsNumeric(txtbox_estrutura_3_vante.Text) Then
If txtbox_estrutura_3_vante = "" Then
txtbox_estrutura_3_vante = ""
Sheets("Dados iniciais").Select
Cells(45, 3).Value = Me.txtbox_estrutura_3_vante.Text
Else
txtbox_estrutura_3_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(45, 3).Value = Me.txtbox_estrutura_3_vante.Text
End If
End Sub

Private Sub txtbox_nome_ld_Change()
Dim s As String
Dim t As String

If IsNumeric(txtbox_nome_ld.Text) Then txtbox_nome_ld.Text = ""

End Sub

Private Sub txtbox_peso_cadeia_Change()
Sheets("Isoladores").Select
Cells(9, 4).Value = Me.txtbox_peso_cadeia.Text
Sheets("Dados iniciais").Select
End Sub

Private Sub txtbox_qtd_vaos_re_Change()
Dim s As String

s = txtbox_qtd_vaos_re.Text

If IsNumeric(txtbox_qtd_vaos_re.Text) Then

If (s > 7) Or (s < 0) Then
txtbox_qtd_vaos_re.Text = ""
MsgBox ("Entre somente com valores reais para até 7 vãos")
End If

Else

If txtbox_qtd_vaos_re = "" Then
txtbox_qtd_vaos_re = ""

Else
If txtbox_qtd_vaos_re = "-" Then
txtbox_qtd_vaos_re = ""
MsgBox ("Entre somente com valores positivos")
Else
txtbox_qtd_vaos_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
End If
End If

End Sub
Private Sub txtbox_qtd_vaos_re_AfterUpdate()

Call mostra_celulas_re
Call mostra_vaos_re

End Sub

Private Sub txtbox_qtd_vaos_vante_Change()
Dim s As String

s = txtbox_qtd_vaos_vante.Text

If IsNumeric(txtbox_qtd_vaos_vante.Text) Then

If (s > 7) Or (s < 0) Then
txtbox_qtd_vaos_vante.Text = ""
MsgBox ("Entre somente com valores reais para até 7 vãos")
End If

Else

If txtbox_qtd_vaos_vante = "" Then
Else
If txtbox_qtd_vaos_vante = "-" Then
txtbox_qtd_vaos_vante = ""
MsgBox ("Entre somente com valores positivos")
Else
txtbox_qtd_vaos_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
End If

End If

End Sub
Private Sub txtbox_qtd_vaos_vante_AfterUpdate()

Call mostra_celulas_vante
Call mostra_vaos_vante

End Sub

Private Sub txtbox_temperatura_operacao_Change()
txtbox_informa_temperatura.Text = txtbox_temperatura_operacao.Text
End Sub

Private Sub txtbox_tracao_antes_rompimento_Change()
If Not IsNumeric(txtbox_tracao_antes_rompimento.Text) Then txtbox_tracao_antes_rompimento.Text = ""
Sheets("Dados iniciais").Select
Cells(92, 2).Value = Me.txtbox_tracao_antes_rompimento.Text
End Sub

Private Sub txtbox_vao_1_re_Change()
If Not IsNumeric(txtbox_vao_1_re.Text) Then
If txtbox_vao_1_re = "" Then
txtbox_vao_1_re = ""
Sheets("Dados iniciais").Select
Cells(21, 3).Value = 0
Else
txtbox_vao_1_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text
End If

End Sub

Private Sub txtbox_vao_1_vante_Change()
If Not IsNumeric(txtbox_vao_1_vante.Text) Then
If txtbox_vao_1_vante = "" Then
txtbox_vao_1_vante = ""
Sheets("Dados iniciais").Select
Cells(23, 3).Value = 0
Else
txtbox_vao_1_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text
End If
End Sub

Private Sub txtbox_vao_2_re_Change()
If Not IsNumeric(txtbox_vao_2_re.Text) Then
If txtbox_vao_2_re = "" Then
txtbox_vao_2_re = ""
Sheets("Dados iniciais").Select
Cells(20, 3).Value = 0
Else
txtbox_vao_2_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(20, 3).Value = Me.txtbox_vao_2_re.Text
End If
End Sub

Private Sub txtbox_vao_2_vante_Change()
If Not IsNumeric(txtbox_vao_2_vante.Text) Then
If txtbox_vao_2_vante = "" Then
txtbox_vao_2_vante = ""
Sheets("Dados iniciais").Select
Cells(24, 3).Value = 0
Else
txtbox_vao_2_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(24, 3).Value = Me.txtbox_vao_2_vante.Text
End If
End Sub

Private Sub txtbox_vao_3_re_Change()
If Not IsNumeric(txtbox_vao_3_re.Text) Then
If txtbox_vao_3_re = "" Then
txtbox_vao_3_re = ""
Sheets("Dados iniciais").Select
Cells(19, 3).Value = 0
Else
txtbox_vao_3_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(19, 3).Value = Me.txtbox_vao_3_re.Text
End If
End Sub

Private Sub txtbox_vao_3_vante_Change()
If Not IsNumeric(txtbox_vao_3_vante.Text) Then
If txtbox_vao_3_vante = "" Then
txtbox_vao_3_vante = ""
Sheets("Dados iniciais").Select
Cells(25, 3).Value = 0
Else
txtbox_vao_3_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(25, 3).Value = Me.txtbox_vao_3_vante.Text
End If
End Sub

Private Sub txtbox_vao_4_re_Change()
If Not IsNumeric(txtbox_vao_4_re.Text) Then
If txtbox_vao_4_re = "" Then
txtbox_vao_4_re = ""
Sheets("Dados iniciais").Select
Cells(18, 3).Value = 0
Else
txtbox_vao_4_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(18, 3).Value = Me.txtbox_vao_4_re.Text
End If
End Sub

Private Sub txtbox_vao_4_vante_Change()
If Not IsNumeric(txtbox_vao_4_vante.Text) Then
If txtbox_vao_4_vante = "" Then
txtbox_vao_4_vante = ""
Sheets("Dados iniciais").Select
Cells(26, 3).Value = 0
Else
txtbox_vao_4_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(26, 3).Value = Me.txtbox_vao_4_vante.Text
End If
End Sub

Private Sub txtbox_vao_5_re_Change()
If Not IsNumeric(txtbox_vao_5_re.Text) Then
If txtbox_vao_5_re = "" Then
txtbox_vao_5_re = ""
Sheets("Dados iniciais").Select
Cells(17, 3).Value = 0
Else
txtbox_vao_5_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(17, 3).Value = Me.txtbox_vao_5_re.Text
End If
End Sub

Private Sub txtbox_vao_5_vante_Change()
If Not IsNumeric(txtbox_vao_5_vante.Text) Then
If txtbox_vao_5_vante = "" Then
txtbox_vao_5_vante = ""
Sheets("Dados iniciais").Select
Cells(27, 3).Value = 0
Else
txtbox_vao_5_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(27, 3).Value = Me.txtbox_vao_5_vante.Text
End If
End Sub

Private Sub txtbox_vao_6_re_Change()
If Not IsNumeric(txtbox_vao_6_re.Text) Then
If txtbox_vao_6_re = "" Then
txtbox_vao_6_re = ""
Sheets("Dados iniciais").Select
Cells(16, 3).Value = 0
Else
txtbox_vao_6_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(16, 3).Value = Me.txtbox_vao_6_re.Text
End If
End Sub

Private Sub txtbox_vao_6_vante_Change()
If Not IsNumeric(txtbox_vao_6_vante.Text) Then
If txtbox_vao_6_vante = "" Then
txtbox_vao_6_vante = ""
Sheets("Dados iniciais").Select
Cells(28, 3).Value = 0
Else
txtbox_vao_6_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(28, 3).Value = Me.txtbox_vao_6_vante.Text
End If
End Sub

Private Sub txtbox_vao_7_re_Change()
If Not IsNumeric(txtbox_vao_7_re.Text) Then
If txtbox_vao_7_re = "" Then
txtbox_vao_7_re = ""
Sheets("Dados iniciais").Select
Cells(15, 3).Value = 0
Else
txtbox_vao_7_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(15, 3).Value = Me.txtbox_vao_7_re.Text
End If
End Sub

Private Sub txtbox_vao_7_vante_Change()
If Not IsNumeric(txtbox_vao_7_vante.Text) Then
If txtbox_vao_7_vante = "" Then
txtbox_vao_7_vante = ""
Sheets("Dados iniciais").Select
Cells(29, 3).Value = 0
Else
txtbox_vao_7_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(29, 3).Value = Me.txtbox_vao_7_vante.Text
End If
End Sub


Private Sub txtbox_vao_analise_Change()
txtbox_vao_1_re.Text = txtbox_vao_analise.Text
txtbox_vao_1_vante.Text = txtbox_vao_analise.Text
End Sub

Private Sub UserForm1_Initialize()
Dim rng As Range
Dim ws As Worksheet
Dim i As Integer

Call maximiza_tela

Cbo_Tensao.Clear  'limpa o combo box alvo
Set ws = Worksheets("Isoladores")  'planilha que está os dados
'loop pelos itens da lista que voce criou
For Each rng In ws.Range("Tensao_kV")
Me.Cbo_Tensao.AddItem rng.Value
Next rng

Cbo_Isolador_Tipo.Clear  'limpa o combo box alvo
Set ws = Worksheets("Isoladores")  'planilha que está os dados
'loop pelos itens da lista que voce criou
For Each rng In ws.Range("isoladores_tipo")
Me.Cbo_Isolador_Tipo.AddItem rng.Value
Next rng

Cbo_Condutor.Clear  'limpa o combo box alvo
Set ws = Worksheets("Condutor")  'planilha que está os dados
'loop pelos itens da lista que voce criou
For Each rng In ws.Range("Condutores")
Me.Cbo_Condutor.AddItem rng.Value
Next rng

Call oculta_dados_vaos_rompidos
Call trava_txt_box
Call zera_celulas

End Sub
Sub mostra_peso_cadeia()

If (Cbo_Tensao.Value = " 69") And (Cbo_Isolador_Tipo.Value = "Vidro") Then
txtbox_peso_cadeia.Text = "23,05"
Else
If (Cbo_Tensao.Value = " 69") And (Cbo_Isolador_Tipo.Value = "Porcelana") Then
txtbox_peso_cadeia.Text = "23,05"
Else
If (Cbo_Tensao.Value = " 69") And (Cbo_Isolador_Tipo.Value = "Polimérico") Then
txtbox_peso_cadeia.Text = "5,00"
Else
If (Cbo_Tensao.Value = "138") And (Cbo_Isolador_Tipo.Value = "Vidro") Then
txtbox_peso_cadeia.Text = "39,05"
Else
If (Cbo_Tensao.Value = "138") And (Cbo_Isolador_Tipo.Value = "Porcelana") Then
txtbox_peso_cadeia.Text = "39,05"
Else
If (Cbo_Tensao.Value = "138") And (Cbo_Isolador_Tipo.Value = "Polimérico") Then
txtbox_peso_cadeia.Text = "5,00"
Else
txtbox_peso_cadeia.Text = ""
End If
End If
End If
End If
End If
End If

End Sub
Sub mostra_comprimento_cadeia()

If (Cbo_Tensao.Value = " 69") And (Cbo_Isolador_Tipo.Value = "Vidro") Then
txtbox_comprimento_cadeia.Text = "1,07"
Else
If (Cbo_Tensao.Value = " 69") And (Cbo_Isolador_Tipo.Value = "Porcelana") Then
txtbox_comprimento_cadeia.Text = "1,07"
Else
If (Cbo_Tensao.Value = " 69") And (Cbo_Isolador_Tipo.Value = "Polimérico") Then
txtbox_comprimento_cadeia.Text = "1,07"
Else
If (Cbo_Tensao.Value = "138") And (Cbo_Isolador_Tipo.Value = "Vidro") Then
txtbox_comprimento_cadeia.Text = "1,65"
Else
If (Cbo_Tensao.Value = "138") And (Cbo_Isolador_Tipo.Value = "Porcelana") Then
txtbox_comprimento_cadeia.Text = "1,65"
Else
If (Cbo_Tensao.Value = "138") And (Cbo_Isolador_Tipo.Value = "Polimérico") Then
txtbox_comprimento_cadeia.Text = "1,65"
Else
txtbox_comprimento_cadeia.Text = ""
End If
End If
End If
End If
End If
End If

End Sub
Sub zera_celulas()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 1
Do While j <= 15
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 1
Do While j <= 15
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

Cells(92, 2).Value = 0

End Sub
Sub zera_celulas_re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 1
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 1
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 1
Do While j <= 7
Cells(i, 3).Value = 0
i = i - 1
j = j + 1
Loop

i = 49
j = 1
Do While j <= 7
Cells(i, 3).Value = 0
i = i - 1
j = j + 1
Loop

End Sub


Private Sub txtbox_estrutura_2_re_Change()
If Not IsNumeric(txtbox_estrutura_2_re.Text) Then
If txtbox_estrutura_2_re = "" Then
txtbox_estrutura_2_re = ""
Sheets("Dados iniciais").Select
Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
Else
txtbox_estrutura_2_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
End If
End Sub

Private Sub txtbox_estrutura_2_vante_Change()
If Not IsNumeric(txtbox_estrutura_2_vante.Text) Then
If txtbox_estrutura_2_vante = "" Then
txtbox_estrutura_2_vante = ""
Sheets("Dados iniciais").Select
Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
Else
txtbox_estrutura_2_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
End If
End Sub

Private Sub txtbox_estrutura_3_re_Change()
If Not IsNumeric(txtbox_estrutura_3_re.Text) Then
If txtbox_estrutura_3_re = "" Then
txtbox_estrutura_3_re = ""
Sheets("Dados iniciais").Select
Cells(39, 3).Value = Me.txtbox_estrutura_3_re.Text
Else
txtbox_estrutura_3_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(39, 3).Value = Me.txtbox_estrutura_3_re.Text
End If
End Sub

Private Sub txtbox_estrutura_4_re_Change()
If Not IsNumeric(txtbox_estrutura_4_re.Text) Then
If txtbox_estrutura_4_re = "" Then
txtbox_estrutura_4_re = ""
Sheets("Dados iniciais").Select
Cells(38, 3).Value = Me.txtbox_estrutura_4_re.Text
Else
txtbox_estrutura_4_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(38, 3).Value = Me.txtbox_estrutura_4_re.Text
End If
End Sub

Private Sub txtbox_estrutura_4_vante_Change()
If Not IsNumeric(txtbox_estrutura_4_vante.Text) Then
If txtbox_estrutura_4_vante = "" Then
txtbox_estrutura_4_vante = ""
Sheets("Dados iniciais").Select
Cells(46, 3).Value = Me.txtbox_estrutura_4_vante.Text
Else
txtbox_estrutura_4_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(46, 3).Value = Me.txtbox_estrutura_4_vante.Text
End If
End Sub

Private Sub txtbox_estrutura_5_re_Change()
If Not IsNumeric(txtbox_estrutura_5_re.Text) Then
If txtbox_estrutura_5_re = "" Then
txtbox_estrutura_5_re = ""
Sheets("Dados iniciais").Select
Cells(37, 3).Value = Me.txtbox_estrutura_5_re.Text
Else
txtbox_estrutura_5_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(37, 3).Value = Me.txtbox_estrutura_5_re.Text
End If
End Sub

Private Sub txtbox_estrutura_5_vante_Change()
If Not IsNumeric(txtbox_estrutura_5_vante.Text) Then
If txtbox_estrutura_5_vante = "" Then
txtbox_estrutura_5_vante = ""
Sheets("Dados iniciais").Select
Cells(47, 3).Value = Me.txtbox_estrutura_5_vante.Text
Else
txtbox_estrutura_5_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(47, 3).Value = Me.txtbox_estrutura_5_vante.Text
End If
End Sub

Private Sub txtbox_estrutura_6_re_Change()
If Not IsNumeric(txtbox_estrutura_6_re.Text) Then
If txtbox_estrutura_6_re = "" Then
txtbox_estrutura_6_re = ""
Sheets("Dados iniciais").Select
Cells(36, 3).Value = Me.txtbox_estrutura_6_re.Text
Else
txtbox_estrutura_6_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(36, 3).Value = Me.txtbox_estrutura_6_re.Text
End If
End Sub

Private Sub txtbox_estrutura_6_vante_Change()
If Not IsNumeric(txtbox_estrutura_6_vante.Text) Then
If txtbox_estrutura_6_vante = "" Then
txtbox_estrutura_6_vante = ""
Sheets("Dados iniciais").Select
Cells(48, 3).Value = Me.txtbox_estrutura_6_vante.Text
Else
txtbox_estrutura_6_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(48, 3).Value = Me.txtbox_estrutura_6_vante.Text
End If
End Sub

Private Sub txtbox_estrutura_7_re_Change()
If Not IsNumeric(txtbox_estrutura_7_re.Text) Then
If txtbox_estrutura_7_re = "" Then
txtbox_estrutura_7_re = ""
Sheets("Dados iniciais").Select
Cells(35, 3).Value = Me.txtbox_estrutura_7_re.Text
Else
txtbox_estrutura_7_re = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(35, 3).Value = Me.txtbox_estrutura_7_re.Text
End If
End Sub

Private Sub txtbox_estrutura_7_vante_Change()
If Not IsNumeric(txtbox_estrutura_7_vante.Text) Then
If txtbox_estrutura_7_vante = "" Then
txtbox_estrutura_7_vante = ""
Sheets("Dados iniciais").Select
Cells(49, 3).Value = Me.txtbox_estrutura_7_vante.Text
Else
txtbox_estrutura_7_vante = ""
MsgBox ("Entre somente com valores numéricos")
End If
Else
Sheets("Dados iniciais").Select
Cells(49, 3).Value = Me.txtbox_estrutura_7_vante.Text
End If
End Sub

Private Sub txtbox_nome_ld_AfterUpdate()
Dim s As String
Dim ld As String

ld = Left(txtbox_nome_ld.Text, 3)
If ld = "LD " Then
Else
s = "LD "
txtbox_nome_ld.Text = s & txtbox_nome_ld.Text
End If

ld = Right(txtbox_nome_ld.Text, 2)
If ld = "kV" Then
Else

If Cbo_Tensao.Text = "" Then
Else

txtbox_nome_ld = txtbox_nome_ld.Text & ", " & Cbo_Tensao.Text & " kV"

End If
End If

End Sub


Private Sub UserForm1_QueryClose(Cancel As Integer, CloseMode As Integer)
    If CloseMode = vbFormControlMenu Then
         
        Cancel = True
        Call CMD_Cancel_Click
    End If
End Sub


Private Sub CMD_Cancel_Click()
    If MsgBox(prompt:=" Você deseja realmente sair?", Buttons:=vbOKCancel) = vbOK Then
         
        ActiveWorkbook.Save
        Application.Quit
    End If
End Sub
Sub mostra_vaos_re()
Dim vaos_re As String

Call oculta_dados_vaos_rompidos_re

vaos_re = txtbox_qtd_vaos_re.Text

If vaos_re = "" Then
Else

If vaos_re = 0 Then
Else

If vaos_re = 1 Then
txtbox_vao_1_re.Visible = True
txtbox_estrutura_1_re.Visible = True
lab_vao_1re.Visible = True
lab_estrutura_1re.Visible = True

Else

If vaos_re = 2 Then

txtbox_vao_1_re.Visible = True
txtbox_vao_2_re.Visible = True
txtbox_estrutura_1_re.Visible = True
txtbox_estrutura_2_re.Visible = True
lab_vao_1re.Visible = True
lab_vao_2re.Visible = True
lab_estrutura_1re.Visible = True
lab_estrutura_2re.Visible = True

Else

If vaos_re = 3 Then

txtbox_vao_1_re.Visible = True
txtbox_vao_2_re.Visible = True
txtbox_vao_3_re.Visible = True
txtbox_estrutura_1_re.Visible = True
txtbox_estrutura_2_re.Visible = True
txtbox_estrutura_3_re.Visible = True
lab_vao_1re.Visible = True
lab_vao_2re.Visible = True
lab_vao_3re.Visible = True
lab_estrutura_1re.Visible = True
lab_estrutura_2re.Visible = True
lab_estrutura_3re.Visible = True

Else

If vaos_re = 4 Then

txtbox_vao_1_re.Visible = True
txtbox_vao_2_re.Visible = True
txtbox_vao_3_re.Visible = True
txtbox_vao_4_re.Visible = True
txtbox_estrutura_1_re.Visible = True
txtbox_estrutura_2_re.Visible = True
txtbox_estrutura_3_re.Visible = True
txtbox_estrutura_4_re.Visible = True
lab_vao_1re.Visible = True
lab_vao_2re.Visible = True
lab_vao_3re.Visible = True
lab_vao_4re.Visible = True
lab_estrutura_1re.Visible = True
lab_estrutura_2re.Visible = True
lab_estrutura_3re.Visible = True
lab_estrutura_4re.Visible = True

Else

If vaos_re = 5 Then

txtbox_vao_1_re.Visible = True
txtbox_vao_2_re.Visible = True
txtbox_vao_3_re.Visible = True
txtbox_vao_4_re.Visible = True
txtbox_vao_5_re.Visible = True
txtbox_estrutura_1_re.Visible = True
txtbox_estrutura_2_re.Visible = True
txtbox_estrutura_3_re.Visible = True
txtbox_estrutura_4_re.Visible = True
txtbox_estrutura_5_re.Visible = True
lab_vao_1re.Visible = True
lab_vao_2re.Visible = True
lab_vao_3re.Visible = True
lab_vao_4re.Visible = True
lab_vao_5re.Visible = True
lab_estrutura_1re.Visible = True
lab_estrutura_2re.Visible = True
lab_estrutura_3re.Visible = True
lab_estrutura_4re.Visible = True
lab_estrutura_5re.Visible = True

Else

If vaos_re = 6 Then

txtbox_vao_1_re.Visible = True
txtbox_vao_2_re.Visible = True
txtbox_vao_3_re.Visible = True
txtbox_vao_4_re.Visible = True
txtbox_vao_5_re.Visible = True
txtbox_vao_6_re.Visible = True
txtbox_estrutura_1_re.Visible = True
txtbox_estrutura_2_re.Visible = True
txtbox_estrutura_3_re.Visible = True
txtbox_estrutura_4_re.Visible = True
txtbox_estrutura_5_re.Visible = True
txtbox_estrutura_6_re.Visible = True
lab_vao_1re.Visible = True
lab_vao_2re.Visible = True
lab_vao_3re.Visible = True
lab_vao_4re.Visible = True
lab_vao_5re.Visible = True
lab_vao_6re.Visible = True
lab_estrutura_1re.Visible = True
lab_estrutura_2re.Visible = True
lab_estrutura_3re.Visible = True
lab_estrutura_4re.Visible = True
lab_estrutura_5re.Visible = True
lab_estrutura_6re.Visible = True

Else

If vaos_re = 7 Then

txtbox_vao_1_re.Visible = True
txtbox_vao_2_re.Visible = True
txtbox_vao_3_re.Visible = True
txtbox_vao_4_re.Visible = True
txtbox_vao_5_re.Visible = True
txtbox_vao_6_re.Visible = True
txtbox_vao_7_re.Visible = True
txtbox_estrutura_1_re.Visible = True
txtbox_estrutura_2_re.Visible = True
txtbox_estrutura_3_re.Visible = True
txtbox_estrutura_4_re.Visible = True
txtbox_estrutura_5_re.Visible = True
txtbox_estrutura_6_re.Visible = True
txtbox_estrutura_7_re.Visible = True
lab_vao_1re.Visible = True
lab_vao_2re.Visible = True
lab_vao_3re.Visible = True
lab_vao_4re.Visible = True
lab_vao_5re.Visible = True
lab_vao_6re.Visible = True
lab_vao_7re.Visible = True
lab_estrutura_1re.Visible = True
lab_estrutura_2re.Visible = True
lab_estrutura_3re.Visible = True
lab_estrutura_4re.Visible = True
lab_estrutura_5re.Visible = True
lab_estrutura_6re.Visible = True
lab_estrutura_7re.Visible = True

End If
End If
End If
End If
End If
End If
End If
End If
End If

End Sub
Sub mostra_vaos_vante()
Dim vaos_vante As String

Call oculta_dados_vaos_rompidos_vante

vaos_vante = txtbox_qtd_vaos_vante.Text

If vaos_vante = "" Then

Else

If vaos_vante = 0 Then

Else

If vaos_vante = 1 Then

txtbox_vao_1_vante.Visible = True
txtbox_estrutura_1_vante.Visible = True
lab_vao_1vante.Visible = True
lab_estrutura_1vante.Visible = True

Else

If vaos_vante = 2 Then

txtbox_vao_1_vante.Visible = True
txtbox_vao_2_vante.Visible = True
txtbox_estrutura_1_vante.Visible = True
txtbox_estrutura_2_vante.Visible = True
lab_vao_1vante.Visible = True
lab_vao_2vante.Visible = True
lab_estrutura_1vante.Visible = True
lab_estrutura_2vante.Visible = True

Else

If vaos_vante = 3 Then

txtbox_vao_1_vante.Visible = True
txtbox_vao_2_vante.Visible = True
txtbox_vao_3_vante.Visible = True
txtbox_estrutura_1_vante.Visible = True
txtbox_estrutura_2_vante.Visible = True
txtbox_estrutura_3_vante.Visible = True
lab_vao_1vante.Visible = True
lab_vao_2vante.Visible = True
lab_vao_3vante.Visible = True
lab_estrutura_1vante.Visible = True
lab_estrutura_2vante.Visible = True
lab_estrutura_3vante.Visible = True

Else

If vaos_vante = 4 Then

txtbox_vao_1_vante.Visible = True
txtbox_vao_2_vante.Visible = True
txtbox_vao_3_vante.Visible = True
txtbox_vao_4_vante.Visible = True
txtbox_estrutura_1_vante.Visible = True
txtbox_estrutura_2_vante.Visible = True
txtbox_estrutura_3_vante.Visible = True
txtbox_estrutura_4_vante.Visible = True
lab_vao_1vante.Visible = True
lab_vao_2vante.Visible = True
lab_vao_3vante.Visible = True
lab_vao_4vante.Visible = True
lab_estrutura_1vante.Visible = True
lab_estrutura_2vante.Visible = True
lab_estrutura_3vante.Visible = True
lab_estrutura_4vante.Visible = True

Else

If vaos_vante = 5 Then

txtbox_vao_1_vante.Visible = True
txtbox_vao_2_vante.Visible = True
txtbox_vao_3_vante.Visible = True
txtbox_vao_4_vante.Visible = True
txtbox_vao_5_vante.Visible = True
txtbox_estrutura_1_vante.Visible = True
txtbox_estrutura_2_vante.Visible = True
txtbox_estrutura_3_vante.Visible = True
txtbox_estrutura_4_vante.Visible = True
txtbox_estrutura_5_vante.Visible = True
lab_vao_1vante.Visible = True
lab_vao_2vante.Visible = True
lab_vao_3vante.Visible = True
lab_vao_4vante.Visible = True
lab_vao_5vante.Visible = True
lab_estrutura_1vante.Visible = True
lab_estrutura_2vante.Visible = True
lab_estrutura_3vante.Visible = True
lab_estrutura_4vante.Visible = True
lab_estrutura_5vante.Visible = True

Else

If vaos_vante = 6 Then

txtbox_vao_1_vante.Visible = True
txtbox_vao_2_vante.Visible = True
txtbox_vao_3_vante.Visible = True
txtbox_vao_4_vante.Visible = True
txtbox_vao_5_vante.Visible = True
txtbox_vao_6_vante.Visible = True
txtbox_estrutura_1_vante.Visible = True
txtbox_estrutura_2_vante.Visible = True
txtbox_estrutura_3_vante.Visible = True
txtbox_estrutura_4_vante.Visible = True
txtbox_estrutura_5_vante.Visible = True
txtbox_estrutura_6_vante.Visible = True
lab_vao_1vante.Visible = True
lab_vao_2vante.Visible = True
lab_vao_3vante.Visible = True
lab_vao_4vante.Visible = True
lab_vao_5vante.Visible = True
lab_vao_6vante.Visible = True
lab_estrutura_1vante.Visible = True
lab_estrutura_2vante.Visible = True
lab_estrutura_3vante.Visible = True
lab_estrutura_4vante.Visible = True
lab_estrutura_5vante.Visible = True
lab_estrutura_6vante.Visible = True

Else

If vaos_vante = 7 Then

txtbox_vao_1_vante.Visible = True
txtbox_vao_2_vante.Visible = True
txtbox_vao_3_vante.Visible = True
txtbox_vao_4_vante.Visible = True
txtbox_vao_5_vante.Visible = True
txtbox_vao_6_vante.Visible = True
txtbox_vao_7_vante.Visible = True
txtbox_estrutura_1_vante.Visible = True
txtbox_estrutura_2_vante.Visible = True
txtbox_estrutura_3_vante.Visible = True
txtbox_estrutura_4_vante.Visible = True
txtbox_estrutura_5_vante.Visible = True
txtbox_estrutura_6_vante.Visible = True
txtbox_estrutura_7_vante.Visible = True
lab_vao_1vante.Visible = True
lab_vao_2vante.Visible = True
lab_vao_3vante.Visible = True
lab_vao_4vante.Visible = True
lab_vao_5vante.Visible = True
lab_vao_6vante.Visible = True
lab_vao_7vante.Visible = True
lab_estrutura_1vante.Visible = True
lab_estrutura_2vante.Visible = True
lab_estrutura_3vante.Visible = True
lab_estrutura_4vante.Visible = True
lab_estrutura_5vante.Visible = True
lab_estrutura_6vante.Visible = True
lab_estrutura_7vante.Visible = True

End If
End If
End If
End If
End If
End If
End If
End If
End If

End Sub
Sub zera_celulas_1re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 7
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 7
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_2re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 6
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 6
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_3re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 5
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 5
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_4re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 4
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 4
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_5re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 3
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 3
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_6re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 2
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 2
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_7re()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 15
j = 1
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

i = 35
j = 1
Do While j <= 7
Cells(i, 3).Value = 0
i = i + 1
j = j + 1
Loop

End Sub
Sub zera_celulas_1vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 0
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

i = 49
j = 0
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

End Sub
Sub zera_celulas_2vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 1
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

i = 49
j = 1
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

End Sub
Sub zera_celulas_3vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 2
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

i = 49
j = 2
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

End Sub
Sub zera_celulas_4vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 3
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

i = 49
j = 3
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

End Sub
Sub zera_celulas_5vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 4
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

i = 49
j = 4
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

End Sub
Sub zera_celulas_6vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 5
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

i = 49
j = 5
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

End Sub
Sub zera_celulas_7vante()
Dim i As Integer
Dim j As Integer

Sheets("Dados iniciais").Select
i = 29
j = 6
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

i = 49
j = 6
Do While j >= 0
Cells(i, 3).Value = 0
i = i - 1
j = j - 1
Loop

End Sub

Sub mostra_celulas_7re()

Sheets("Dados iniciais").Select
Cells(15, 3).Value = Me.txtbox_vao_7_re.Text
Cells(16, 3).Value = Me.txtbox_vao_6_re.Text
Cells(17, 3).Value = Me.txtbox_vao_5_re.Text
Cells(18, 3).Value = Me.txtbox_vao_4_re.Text
Cells(19, 3).Value = Me.txtbox_vao_3_re.Text
Cells(20, 3).Value = Me.txtbox_vao_2_re.Text
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text

Cells(35, 3).Value = Me.txtbox_estrutura_7_re.Text
Cells(36, 3).Value = Me.txtbox_estrutura_6_re.Text
Cells(37, 3).Value = Me.txtbox_estrutura_5_re.Text
Cells(38, 3).Value = Me.txtbox_estrutura_4_re.Text
Cells(39, 3).Value = Me.txtbox_estrutura_3_re.Text
Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text

End Sub

Sub mostra_celulas_6re()

Sheets("Dados iniciais").Select
Cells(16, 3).Value = Me.txtbox_vao_6_re.Text
Cells(17, 3).Value = Me.txtbox_vao_5_re.Text
Cells(18, 3).Value = Me.txtbox_vao_4_re.Text
Cells(19, 3).Value = Me.txtbox_vao_3_re.Text
Cells(20, 3).Value = Me.txtbox_vao_2_re.Text
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text

Cells(36, 3).Value = Me.txtbox_estrutura_6_re.Text
Cells(37, 3).Value = Me.txtbox_estrutura_5_re.Text
Cells(38, 3).Value = Me.txtbox_estrutura_4_re.Text
Cells(39, 3).Value = Me.txtbox_estrutura_3_re.Text
Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text

End Sub

Sub mostra_celulas_5re()

Sheets("Dados iniciais").Select
Cells(17, 3).Value = Me.txtbox_vao_5_re.Text
Cells(18, 3).Value = Me.txtbox_vao_4_re.Text
Cells(19, 3).Value = Me.txtbox_vao_3_re.Text
Cells(20, 3).Value = Me.txtbox_vao_2_re.Text
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text

Cells(37, 3).Value = Me.txtbox_estrutura_5_re.Text
Cells(38, 3).Value = Me.txtbox_estrutura_4_re.Text
Cells(39, 3).Value = Me.txtbox_estrutura_3_re.Text
Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text

End Sub

Sub mostra_celulas_4re()

Sheets("Dados iniciais").Select
Cells(18, 3).Value = Me.txtbox_vao_4_re.Text
Cells(19, 3).Value = Me.txtbox_vao_3_re.Text
Cells(20, 3).Value = Me.txtbox_vao_2_re.Text
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text

Cells(38, 3).Value = Me.txtbox_estrutura_4_re.Text
Cells(39, 3).Value = Me.txtbox_estrutura_3_re.Text
Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text

End Sub

Sub mostra_celulas_3re()

Sheets("Dados iniciais").Select
Cells(19, 3).Value = Me.txtbox_vao_3_re.Text
Cells(20, 3).Value = Me.txtbox_vao_2_re.Text
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text

Cells(39, 3).Value = Me.txtbox_estrutura_3_re.Text
Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text

End Sub
Sub mostra_celulas_2re()

Sheets("Dados iniciais").Select
Cells(20, 3).Value = Me.txtbox_vao_2_re.Text
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text

Cells(40, 3).Value = Me.txtbox_estrutura_2_re.Text
Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text

End Sub

Sub mostra_celulas_1re()

Sheets("Dados iniciais").Select
Cells(21, 3).Value = Me.txtbox_vao_1_re.Text

Cells(41, 3).Value = Me.txtbox_estrutura_1_re.Text

End Sub
Sub mostra_celulas_7vante()

Sheets("Dados iniciais").Select
Cells(29, 3).Value = Me.txtbox_vao_7_vante.Text
Cells(28, 3).Value = Me.txtbox_vao_6_vante.Text
Cells(27, 3).Value = Me.txtbox_vao_5_vante.Text
Cells(26, 3).Value = Me.txtbox_vao_4_vante.Text
Cells(25, 3).Value = Me.txtbox_vao_3_vante.Text
Cells(24, 3).Value = Me.txtbox_vao_2_vante.Text
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text

Cells(49, 3).Value = Me.txtbox_estrutura_7_vante.Text
Cells(48, 3).Value = Me.txtbox_estrutura_6_vante.Text
Cells(47, 3).Value = Me.txtbox_estrutura_5_vante.Text
Cells(46, 3).Value = Me.txtbox_estrutura_4_vante.Text
Cells(45, 3).Value = Me.txtbox_estrutura_3_vante.Text
Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text

End Sub

Sub mostra_celulas_6vante()

Sheets("Dados iniciais").Select
Cells(28, 3).Value = Me.txtbox_vao_6_vante.Text
Cells(27, 3).Value = Me.txtbox_vao_5_vante.Text
Cells(26, 3).Value = Me.txtbox_vao_4_vante.Text
Cells(25, 3).Value = Me.txtbox_vao_3_vante.Text
Cells(24, 3).Value = Me.txtbox_vao_2_vante.Text
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text

Cells(48, 3).Value = Me.txtbox_estrutura_6_vante.Text
Cells(47, 3).Value = Me.txtbox_estrutura_5_vante.Text
Cells(46, 3).Value = Me.txtbox_estrutura_4_vante.Text
Cells(45, 3).Value = Me.txtbox_estrutura_3_vante.Text
Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text

End Sub

Sub mostra_celulas_5vante()

Sheets("Dados iniciais").Select
Cells(27, 3).Value = Me.txtbox_vao_5_vante.Text
Cells(26, 3).Value = Me.txtbox_vao_4_vante.Text
Cells(25, 3).Value = Me.txtbox_vao_3_vante.Text
Cells(24, 3).Value = Me.txtbox_vao_2_vante.Text
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text

Cells(47, 3).Value = Me.txtbox_estrutura_5_vante.Text
Cells(46, 3).Value = Me.txtbox_estrutura_4_vante.Text
Cells(45, 3).Value = Me.txtbox_estrutura_3_vante.Text
Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text

End Sub

Sub mostra_celulas_4vante()

Sheets("Dados iniciais").Select
Cells(26, 3).Value = Me.txtbox_vao_4_vante.Text
Cells(25, 3).Value = Me.txtbox_vao_3_vante.Text
Cells(24, 3).Value = Me.txtbox_vao_2_vante.Text
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text

Cells(46, 3).Value = Me.txtbox_estrutura_4_vante.Text
Cells(45, 3).Value = Me.txtbox_estrutura_3_vante.Text
Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text

End Sub

Sub mostra_celulas_3vante()

Sheets("Dados iniciais").Select
Cells(25, 3).Value = Me.txtbox_vao_3_vante.Text
Cells(24, 3).Value = Me.txtbox_vao_2_vante.Text
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text

Cells(45, 3).Value = Me.txtbox_estrutura_3_vante.Text
Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text

End Sub
Sub mostra_celulas_2vante()

Sheets("Dados iniciais").Select
Cells(24, 3).Value = Me.txtbox_vao_2_vante.Text
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text

Cells(44, 3).Value = Me.txtbox_estrutura_2_vante.Text
Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text

End Sub

Sub mostra_celulas_1vante()

Sheets("Dados iniciais").Select
Cells(23, 3).Value = Me.txtbox_vao_1_vante.Text

Cells(43, 3).Value = Me.txtbox_estrutura_1_vante.Text

End Sub

Sub maximiza_tela()

Application.WindowState = xlMaximized
Me.Height = Application.Height
Me.Width = Application.Width
Me.Left = Application.Left
Me.Top = Application.Top

End Sub

Sub oculta_dados_vaos_rompidos_re()

txtbox_vao_7_re.Visible = False
txtbox_vao_6_re.Visible = False
txtbox_vao_5_re.Visible = False
txtbox_vao_4_re.Visible = False
txtbox_vao_3_re.Visible = False
txtbox_vao_2_re.Visible = False
txtbox_vao_1_re.Visible = False
txtbox_estrutura_7_re.Visible = False
txtbox_estrutura_6_re.Visible = False
txtbox_estrutura_5_re.Visible = False
txtbox_estrutura_4_re.Visible = False
txtbox_estrutura_3_re.Visible = False
txtbox_estrutura_2_re.Visible = False
txtbox_estrutura_1_re.Visible = False
lab_vao_7re.Visible = False
lab_vao_6re.Visible = False
lab_vao_5re.Visible = False
lab_vao_4re.Visible = False
lab_vao_3re.Visible = False
lab_vao_2re.Visible = False
lab_vao_1re.Visible = False
lab_estrutura_7re.Visible = False
lab_estrutura_6re.Visible = False
lab_estrutura_5re.Visible = False
lab_estrutura_4re.Visible = False
lab_estrutura_3re.Visible = False
lab_estrutura_2re.Visible = False
lab_estrutura_1re.Visible = False


End Sub

Sub oculta_dados_vaos_rompidos_vante()

txtbox_vao_7_vante.Visible = False
txtbox_vao_6_vante.Visible = False
txtbox_vao_5_vante.Visible = False
txtbox_vao_4_vante.Visible = False
txtbox_vao_3_vante.Visible = False
txtbox_vao_2_vante.Visible = False
txtbox_vao_1_vante.Visible = False
txtbox_estrutura_7_vante.Visible = False
txtbox_estrutura_6_vante.Visible = False
txtbox_estrutura_5_vante.Visible = False
txtbox_estrutura_4_vante.Visible = False
txtbox_estrutura_3_vante.Visible = False
txtbox_estrutura_2_vante.Visible = False
txtbox_estrutura_1_vante.Visible = False
lab_vao_7vante.Visible = False
lab_vao_6vante.Visible = False
lab_vao_5vante.Visible = False
lab_vao_4vante.Visible = False
lab_vao_3vante.Visible = False
lab_vao_2vante.Visible = False
lab_vao_1vante.Visible = False
lab_estrutura_7vante.Visible = False
lab_estrutura_6vante.Visible = False
lab_estrutura_5vante.Visible = False
lab_estrutura_4vante.Visible = False
lab_estrutura_3vante.Visible = False
lab_estrutura_2vante.Visible = False
lab_estrutura_1vante.Visible = False

End Sub

Sub oculta_dados_vaos_rompidos()

txtbox_vao_7_re.Visible = False
txtbox_vao_6_re.Visible = False
txtbox_vao_5_re.Visible = False
txtbox_vao_4_re.Visible = False
txtbox_vao_3_re.Visible = False
txtbox_vao_2_re.Visible = False
txtbox_vao_1_re.Visible = False
txtbox_estrutura_7_re.Visible = False
txtbox_estrutura_6_re.Visible = False
txtbox_estrutura_5_re.Visible = False
txtbox_estrutura_4_re.Visible = False
txtbox_estrutura_3_re.Visible = False
txtbox_estrutura_2_re.Visible = False
txtbox_estrutura_1_re.Visible = False
lab_vao_7re.Visible = False
lab_vao_6re.Visible = False
lab_vao_5re.Visible = False
lab_vao_4re.Visible = False
lab_vao_3re.Visible = False
lab_vao_2re.Visible = False
lab_vao_1re.Visible = False
lab_estrutura_7re.Visible = False
lab_estrutura_6re.Visible = False
lab_estrutura_5re.Visible = False
lab_estrutura_4re.Visible = False
lab_estrutura_3re.Visible = False
lab_estrutura_2re.Visible = False
lab_estrutura_1re.Visible = False

txtbox_vao_7_vante.Visible = False
txtbox_vao_6_vante.Visible = False
txtbox_vao_5_vante.Visible = False
txtbox_vao_4_vante.Visible = False
txtbox_vao_3_vante.Visible = False
txtbox_vao_2_vante.Visible = False
txtbox_vao_1_vante.Visible = False
txtbox_estrutura_7_vante.Visible = False
txtbox_estrutura_6_vante.Visible = False
txtbox_estrutura_5_vante.Visible = False
txtbox_estrutura_4_vante.Visible = False
txtbox_estrutura_3_vante.Visible = False
txtbox_estrutura_2_vante.Visible = False
txtbox_estrutura_1_vante.Visible = False
lab_vao_7vante.Visible = False
lab_vao_6vante.Visible = False
lab_vao_5vante.Visible = False
lab_vao_4vante.Visible = False
lab_vao_3vante.Visible = False
lab_vao_2vante.Visible = False
lab_vao_1vante.Visible = False
lab_estrutura_7vante.Visible = False
lab_estrutura_6vante.Visible = False
lab_estrutura_5vante.Visible = False
lab_estrutura_4vante.Visible = False
lab_estrutura_3vante.Visible = False
lab_estrutura_2vante.Visible = False
lab_estrutura_1vante.Visible = False


End Sub
'trava as texbox, impedindo que o usuário entre com dados nas mesmas
Sub trava_txt_box()

Me.txtbox_constante_catenaria_pos_rompimento.Enabled = False
Me.txtbox_tracao_pos_rompimento.Enabled = False
Me.txtbox_informa_temperatura.Enabled = False

End Sub
Sub mostra_celulas_re()
Dim celulas_re As String

Call zera_celulas_re
celulas_re = txtbox_qtd_vaos_re.Text

If celulas_re = "" Then
Else

If celulas_re = 0 Then
Else

If celulas_re = 1 Then
Call mostra_celulas_1re
Else

If celulas_re = 2 Then
Call mostra_celulas_2re
Else

If celulas_re = 3 Then
Call mostra_celulas_3re
Else

If celulas_re = 4 Then
Call mostra_celulas_4re
Else

If celulas_re = 5 Then
Call mostra_celulas_5re
Else

If celulas_re = 6 Then
Call mostra_celulas_6re
Else

If celulas_re = 7 Then
Call mostra_celulas_7re

End If
End If
End If
End If
End If
End If
End If
End If
End If

End Sub

Sub mostra_celulas_vante()
Dim celulas_vante As String

Call zera_celulas_vante
celulas_vante = txtbox_qtd_vaos_vante.Text

If celulas_vante = "" Then
Else

If celulas_vante = 0 Then
Else

If celulas_vante = 1 Then
Call mostra_celulas_1vante
Else

If celulas_vante = 2 Then
Call mostra_celulas_2vante
Else

If celulas_vante = 3 Then
Call mostra_celulas_3vante
Else

If celulas_vante = 4 Then
Call mostra_celulas_4vante
Else

If celulas_vante = 5 Then
Call mostra_celulas_5vante
Else

If celulas_vante = 6 Then
Call mostra_celulas_6vante
Else

If celulas_vante = 7 Then
Call mostra_celulas_7vante

End If
End If
End If
End If
End If
End If
End If
End If
End If

End Sub

Private Sub UserForm_Click()

End Sub
 

 

Trata-se de um programa que estou desenvolvendo para abaixamento de cabos em LTs.

Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152k
    • Posts
      651,7k
×
×
  • Criar Novo...