Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default looking for a way to make a form Txtbox only visable on Mondays


hi,

I'm looking for a way to make a text box on a form only visible on
certain days of the week. the code i have tried is below. its a bit
naive to be honest so any suggestions would be appreciated:

Private Sub UserForm_Initialize()

If Date = vbSaturday Then
LblIntMon.Caption = "Weight"
TxtBody.Visible = False

TxtBody.Text = LastWeight
Else
LblIntMon.Caption = ""
TxtBody.Visible = False
TxtBody.Text = LastWeight

End If

Thanks in advance


--
andywalker
------------------------------------------------------------------------
andywalker's Profile: http://www.excelforum.com/member.php...o&userid=24418
View this thread: http://www.excelforum.com/showthread...hreadid=382216

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 111
Default looking for a way to make a form Txtbox only visable on Mondays

Your example references Saturday. If it is to be visible only on Mondays,
have the text box visible property set to False if the day is not Monday:

If Weekday(Now, 2) <1 then ......

If you have multiple days, for example only visible Mon-Fri

If Weekday(Now, 2) <6 then ......


--
Damon Longworth

Don't miss out on the 2005 Excel User Conference
Sept 16th and 17th
Stockyards Hotel - Ft. Worth, Texas
www.ExcelUserConference.com


"andywalker" wrote
in message ...

hi,

I'm looking for a way to make a text box on a form only visible on
certain days of the week. the code i have tried is below. its a bit
naive to be honest so any suggestions would be appreciated:

Private Sub UserForm_Initialize()

If Date = vbSaturday Then
LblIntMon.Caption = "Weight"
TxtBody.Visible = False

TxtBody.Text = LastWeight
Else
LblIntMon.Caption = ""
TxtBody.Visible = False
TxtBody.Text = LastWeight

End If

Thanks in advance


--
andywalker
------------------------------------------------------------------------
andywalker's Profile:
http://www.excelforum.com/member.php...o&userid=24418
View this thread: http://www.excelforum.com/showthread...hreadid=382216



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default looking for a way to make a form Txtbox only visable on Mondays


you are almost there.

it will hide txtbox if it is satuday,



Private Sub UserForm_Initialize()

If Weekday(Date, vbSaturday) = 1 Then
LblIntMon.Caption = "Weight"
TxtBody.Visible = False

TxtBody.Text = LastWeight
Else
LblIntMon.Caption = ""
TxtBody.Visible = True
TxtBody.Text = LastWeight

End If


--
anilsolipuram
------------------------------------------------------------------------
anilsolipuram's Profile: http://www.excelforum.com/member.php...o&userid=16271
View this thread: http://www.excelforum.com/showthread...hreadid=382216

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default looking for a way to make a form Txtbox only visable on Mondays


Thanks that worked great

And

--
andywalke
-----------------------------------------------------------------------
andywalker's Profile: http://www.excelforum.com/member.php...fo&userid=2441
View this thread: http://www.excelforum.com/showthread.php?threadid=38221

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Make CommandButtons Not Visable With A Macro Minitman Excel Worksheet Functions 7 April 1st 08 05:55 AM
How can I make the autosum refer to visable rows / filter? Maria[_2_] Excel Worksheet Functions 6 February 12th 08 12:18 AM
how can I make a form number change everytime the form is opened babydumplingspita Excel Worksheet Functions 1 October 10th 05 07:58 PM
txtbox problem [email protected] Excel Programming 0 May 18th 05 05:11 PM
Validateing a txtbox from form Lou Excel Programming 1 April 28th 04 07:25 PM


All times are GMT +1. The time now is 01:22 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"