ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Hide a TextBox (https://www.excelbanter.com/excel-programming/426959-hide-textbox.html)

Patrick C. Simonds

Hide a TextBox
 
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


Rick Rothstein

Hide a TextBox
 
Try adding this line as the last line of code...

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

--
Rick (MVP - Excel)


"Patrick C. Simonds" wrote in message
...
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[_1095_]

Hide a TextBox
 

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


Patrick C. Simonds;309518 Wrote:
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)
------------------------------------------------------------------------
Simon Lloyd's Profile: http://www.thecodecage.com/forumz/member.php?userid=1
View this thread: http://www.thecodecage.com/forumz/sh...ad.php?t=86545



All times are GMT +1. The time now is 07:28 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com