• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Message Errors How To Do It!

hey guys ! Im a New member of this comunity! And im doing a project with VBA Excel ... And i Never Worked With VBA Excel ... Can u help me?

So im trying to put Message Errors , Can u Help me?
I will send my project ,

In UserForm 3 --> I need that the program does not let you register the users with the same number of the company. And Next Give a Message Saying That!

In UserForm 4 -->if we try to enter a Warehouse that already exists tell that Already exists and that you cant enter again, and that you do not leave re-entering a warehouse equal!

In UserForm 5 --> If I try to Delete a Warehouse and this Warehouse does not exist , I need to say in a MsgBox that the Storage Selected does not Exist in the worksheet

In UserForm 9 -->
If I try to Delete Any Day that is not .
The Program must warn you that the day you entered does not exist
 

Attachments

Hi,

Welcome to the forum :)

So:
In UserForm 3 --> I need that the program does not let you register the users with the same number of the company. And Next Give a Message Saying That!

What is the number of the company that shouldn't be allowed... or did you mean to say an already existing number? If it's the latter you can use something similar to the code for the warehouses (see below);

In UserForm 4 -->if we try to enter a Warehouse that already exists tell that Already exists and that you cant enter again, and that you do not leave re-entering a warehouse equal!

Something like:
Code:
Private Sub CommandButton1_Click()

    If TextBox2 = "" Then
        MsgBox "Campo em Branco! Introduza um Armazem. "
        TextBox2.SetFocus
        Exit Sub

    ElseIf Not Sheets("Armazens").Columns("B").Find(what:=Me.TextBox2) Is Nothing Then
        MsgBox "O armazém já existe... não é possível registar!", vbCritical
        Me.TextBox2 = ""
        Me.TextBox2.SetFocus
        Exit Sub

    Else
       
        Call Inserir_Armazens.InserirArm
        MsgBox "Registado Com Sucesso"
        TextBox2.Text = ""
    End If

End Sub

In UserForm 5 --> If I try to Delete a Warehouse and this Warehouse does not exist , I need to say in a MsgBox that the Storage Selected does not Exist in the worksheet

Here I would suggest a different approach... instead of asking the user to type in the warehouse ID, what do you think of having them select the warehouse from a list of existing warehouses? They wouldn't need to know the warehouse ID by heart and you wouldn't have to check if it exists.

Last but not least, I noticed that the Userforms are in Portuguese so, if you prefer, and since I'm Portuguese, engage me in conversation and I will try to help you improve what you already have. We could talk Portuguese there :)

Hope this helps.
 
Last edited:
Back
Top