• 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.

I Need help to hide or Show a commandButton according to a textbox(or cell)value

I am working on a little project, it is simple. It has a sheet where there are some stored names, dates, and some VLookup simple formulas. I have created a userform called "SOP", this in userform automatically displays the information according to the current date. The "SOP" userform has a CommandButton called "NOMOD", I need that this CommandButton to be displayed when the textbox 1(or textbox2) show the words "NOMOD", and when the textbox(or textbox2) shows data again, the NOMOD CommandButton will automatically disappears. Is the a way to do this?

I am attaching the original file and some pictures of what I need.
Thank you so much In advance and Merry Christmas.
 

Attachments

  • Picture 1.JPG
    Picture 1.JPG
    31.8 KB · Views: 11
  • Picture 2.JPG
    Picture 2.JPG
    30.2 KB · Views: 10
  • Sebastian File.xlsm
    165.2 KB · Views: 6
Hi, Seb
Try some thing like
Code:
Private Sub UserForm_Initialize()
    TxtDate.BackColor = vbBlack
    TextBox1.BackColor = vbCyan
    TextBox2.BackColor = vbCyan
    TxtDate.Text = Format(Now(), "Long Date")
    TextBox1.Text = Sheets("SOP").Range("C1").Value
    TextBox2.Text = Sheets("SOP").Range("E1").Value
    If TextBox1.Value = "NOMOD" Or TextBox2.Value = "NOMOD" Then
        NOMOD.Visible = False
        With TextBox1
            .Height = TextBox2.Height * 2
            .Width = TextBox2.Width * 2
            .Left = TextBox2.Left - TextBox2.Width / 3
            .Value = "No WEEKEND MOD according to current Date"
        End With
        TextBox2.Visible = False
        TxtDate.Visible = False
    End If
End Sub
 
Back
Top