Procedure doen´t result

KhallP

Board Regular
Joined
Mar 30, 2021
Messages
157
Office Version
  1. 2016
Platform
  1. Windows
Hello guys, i have a problem in my procedure, everything that happens before trying to execute the procedure is read by the program,
but when we call the procedure it doesn't just work in the specific form, can someone help me?



me.JPG





This codes works:


VBA Code:
Private Sub bt_calculate_Click()

    Call CheckEmpty

End Sub


Private Sub CheckEmpty()
    
If Not IsNumeric(tb_z_value_.Value) Or tb_z_value_.Text = "" Or Trim(tb_z_value_.Text) = "" Then
    MsgBox "'Z Value ' está vazio ou contém números", vbExclamation
    
ElseIf Not IsNumeric(tb_x_value_.Value) Or tb_x_value_.Text = "" Or Trim(tb_x_value_.Text) = "" Then
    MsgBox "'Y Value ' está vazio ou contém números", vbExclamation
    
ElseIf Not IsNumeric(tb_100.Value) Or tb_100.Text = "" Or Trim(tb_100.Text) = "" Then
    MsgBox "'Z = 100 ' está vazio ou contém números", vbExclamation
    
ElseIf Not IsNumeric(tb_250.Value) Or tb_250.Text = "" Or Trim(tb_250.Text) = "" Then
    MsgBox "'Z = 250 ' está vazio ou contém números", vbExclamation
    
ElseIf Not IsNumeric(tb_400.Value) Or tb_400.Text = "" Or Trim(tb_400.Text) = "" Then
    MsgBox "'Z = 400 ' está vazio ou contém números", vbExclamation
    
ElseIf Not IsNumeric(tb_550.Value) Or tb_550.Text = "" Or Trim(tb_550.Text) = "" Then
    MsgBox "'Z = 550 ' está vazio ou contém números", vbExclamation
    
    
Else

    Z_Axis_Final = tb_z_value_.Value
    X_Axis_Final = tb_x_value_.Value
    Z_100_Final = tb_100.Value
    Z_250_Final = tb_250.Value
    Z_400_Final = tb_400.Value
    Z_550_Final = tb_550.Value
    lb_result.Caption = Z_Axis_Final * 1 - Y_Axis_Final * 1
    tb_z_value_.Enabled = False
    tb_x_value_.Enabled = False
    bt_calculate.Enabled = False
    tb_100.Enabled = False
    tb_250.Enabled = False
    tb_400.Enabled = False
    tb_550.Enabled = False
    bt_next.Enabled = True
//Call Procedure doesn´t work
    Call ShowTextBox

End If
End Sub



This code doesn´t work:

Code:
Private Sub ShowTextBox()


If Z_Axis_Final < 0 And X_Axis_Final < 0 Then

    If Z_Axis_Final * 1 - X_Axis_Final * 1 <= 30 And Z_Axis_Final * 1 - X_Axis_Final * 1 >= -30 Then
        txt_a.Visible = True
        lb_aditional.Visible = True
        bt_ok.Visible = True
        
    ElseIf Z_Axis_Final * 1 - X_Axis_Final * 1 > 30 Or Z_Axis_Final * 1 - X_Axis_Final * 1 < -30 Then
    End If
    
              
ElseIf Z_Axis_Final > 0 And X_Axis_Final < 0 Then

    If Z_Axis_Final - X_Axis_Final * 1 <= 30 And Z_Axis_Final - X_Axis_Final * 1 >= -30 Then
        txt_a.Visible = True
        lb_aditional.Visible = True
        bt_ok.Visible = True
        
    ElseIf Z_Axis_Final - X_Axis_Final * 1 > 30 Or Z_Axis_Final - X_Axis_Final * 1 < -30 Then
    End If
    
                
ElseIf Z_Axis_Final > 0 And X_Axis_Final > 0 Then

    If Z_Axis_Final - X_Axis_Final >= -30 And Z_Axis_Final - X_Axis_Final <= 30 Then
        txt_a.Visible = True
        lb_aditional.Visible = True
        bt_ok.Visible = True
        
    ElseIf Z_Axis_Final - X_Axis_Final > 30 Or Z_Axis_Final - X_Axis_Final < -30 Then
    End If
          
          
ElseIf Z_Axis_Final < 0 And X_Axis_Final > 0 Then

    If Z_Axis_Final * 1 - X_Axis_Final <= 30 And Z_Axis_Final * 1 - X_Axis_Final >= -30 Then
        txt_a.Visible = True
        lb_aditional.Visible = True
        bt_ok.Visible = True
        
    ElseIf Z_Axis_Final * 1 - X_Axis_Final > 30 And Z_Axis_Final * 1 - X_Axis_Final < -30 Then
    End If
        
End If
End Sub
 

Excel Facts

Difference between two dates
Secret function! Use =DATEDIF(A2,B2,"Y")&" years"&=DATEDIF(A2,B2,"YM")&" months"&=DATEDIF(A2,B2,"MD")&" days"
Where are those variables - Z_Axis_Final and X_Axis_Final - declared?
 
Upvote 0
Solution
oh, I forgot to check, my X_AxisFinal variable was missing an "_", thanks man
 

Attachments

  • Capturar.JPG
    Capturar.JPG
    10.5 KB · Views: 11
Upvote 0

Forum statistics

Threads
1,223,889
Messages
6,175,224
Members
452,620
Latest member
dsubash

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top