Hide a TextBox

P

Patrick C. Simonds

What can I add to the code below to make TextBox131 not visable if the value
(month) in TextBox501 is April?

Private Sub UserForm_Initialize()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

TextBox500.Value = range("A4").Value
TextBox501.Value = rng(1, 1)
TextBox501.Text = Format(TextBox501.Text, "MMMM")

End Sub
 
R

Rick Rothstein

Try adding this line as the last line of code...

TextBox131.Visible = (TextBox501.Text <> "April")
 
S

Simon Lloyd

Is this what you wanted or do you want to hide it if it contains the
current month?
Private Sub UserForm_Initialize()
Dim rng
Set rng = Cells(ActiveCell.Row, 1)
Me.TextBox500.Value = Range("A4").Value
Me.TextBox501.Value = rng(1, 1)
Me.TextBox501.Text = Format(Me.TextBox501.Text, "MMMM")
If Me.TextBox501.Text = "April" Then
Me.TextBox501.Visible = False
End If
End Sub

What can I add to the code below to make TextBox131 not visable if the
value
(month) in TextBox501 is April?

Private Sub UserForm_Initialize()

Dim rng
Set rng = Cells(ActiveCell.Row, 1)

TextBox500.Value = range("A4").Value
TextBox501.Value = rng(1, 1)
TextBox501.Text = Format(TextBox501.Text, "MMMM")

End Sub


--
Simon Lloyd

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top