Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default checkbox1 value = true if range got data

i got a checkbox1 on a userform

column n down i got dates for this month 1 thru 31

checkbox1 needs be value = true if data next to todays date are enterd
allready.

and
if checkbox1 value = true then textbox1.enable = false
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default checkbox1 value = true if range got data

There are only 29 days in this month. :) These are valid dates, not just
numbers from 1 to 31 (29) with a month for a header?

Mike F
"pswanie" wrote in message
...
i got a checkbox1 on a userform

column n down i got dates for this month 1 thru 31

checkbox1 needs be value = true if data next to todays date are enterd
allready.

and
if checkbox1 value = true then textbox1.enable = false



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default checkbox1 value = true if range got data

Try some code like the following:

Dim R As Range
Dim B As Boolean
For Each R In Worksheets("Sheet1").Range("D1:D31") '<<< CHANGE AS NEEDED
If Int(R.Value) = Int(Now) Then
If R(1, 2).Value < vbNullString Then
B = True
End If
Exit For
End If
Next R

If B = True Then
CheckBox1.Value = True
TextBox1.Enabled = False
End If


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"pswanie" wrote in message
...
i got a checkbox1 on a userform

column n down i got dates for this month 1 thru 31

checkbox1 needs be value = true if data next to todays date are enterd
allready.

and
if checkbox1 value = true then textbox1.enable = false


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 247
Default checkbox1 value = true if range got data

where would i put this code? i tried it under a commandbutton1_click and
userform initialize

(and yip if feb got 28 days then we just ignore the first to days of march
etc)

"Chip Pearson" wrote:

Try some code like the following:

Dim R As Range
Dim B As Boolean
For Each R In Worksheets("Sheet1").Range("D1:D31") '<<< CHANGE AS NEEDED
If Int(R.Value) = Int(Now) Then
If R(1, 2).Value < vbNullString Then
B = True
End If
Exit For
End If
Next R

If B = True Then
CheckBox1.Value = True
TextBox1.Enabled = False
End If


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"pswanie" wrote in message
...
i got a checkbox1 on a userform

column n down i got dates for this month 1 thru 31

checkbox1 needs be value = true if data next to todays date are enterd
allready.

and
if checkbox1 value = true then textbox1.enable = false


  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7,247
Default checkbox1 value = true if range got data

where would i put this code? i tried it under a commandbutton1_click and
userform initialize


The code can go anywhere you want, really. Did it not work when it was
attached to CommandButton1? What error(s) did you get?


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"pswanie" wrote in message
...
where would i put this code? i tried it under a commandbutton1_click and
userform initialize

(and yip if feb got 28 days then we just ignore the first to days of march
etc)

"Chip Pearson" wrote:

Try some code like the following:

Dim R As Range
Dim B As Boolean
For Each R In Worksheets("Sheet1").Range("D1:D31") '<<< CHANGE AS NEEDED
If Int(R.Value) = Int(Now) Then
If R(1, 2).Value < vbNullString Then
B = True
End If
Exit For
End If
Next R

If B = True Then
CheckBox1.Value = True
TextBox1.Enabled = False
End If


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"pswanie" wrote in message
...
i got a checkbox1 on a userform

column n down i got dates for this month 1 thru 31

checkbox1 needs be value = true if data next to todays date are enterd
allready.

and
if checkbox1 value = true then textbox1.enable = false





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,092
Default checkbox1 value = true if range got data

I have a feeling that the column just has numbers, not dates
(and yip if feb got 28 days then we just ignore the first to days of
march
etc)

so the line of code: If Int(R.Value) = Int(Now) Then
would be comparing 6 to 2/6/2008 for today and not finding a match.

pswanie, you should put actual dates in each cell, ie 2/1/2008 for February
1, 2008 (unless you use European dates)
and you can drag that cell down to the end of Feb.

Mike F
"Chip Pearson" wrote in message
...
where would i put this code? i tried it under a commandbutton1_click and
userform initialize


The code can go anywhere you want, really. Did it not work when it was
attached to CommandButton1? What error(s) did you get?


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)



"pswanie" wrote in message
...
where would i put this code? i tried it under a commandbutton1_click and
userform initialize

(and yip if feb got 28 days then we just ignore the first to days of
march
etc)

"Chip Pearson" wrote:

Try some code like the following:

Dim R As Range
Dim B As Boolean
For Each R In Worksheets("Sheet1").Range("D1:D31") '<<< CHANGE AS NEEDED
If Int(R.Value) = Int(Now) Then
If R(1, 2).Value < vbNullString Then
B = True
End If
Exit For
End If
Next R

If B = True Then
CheckBox1.Value = True
TextBox1.Enabled = False
End If


--
Cordially,
Chip Pearson
Microsoft Most Valuable Professional
Excel Product Group, 1998 - 2008
Pearson Software Consulting, LLC
www.cpearson.com
(email on web site)


"pswanie" wrote in message
...
i got a checkbox1 on a userform

column n down i got dates for this month 1 thru 31

checkbox1 needs be value = true if data next to todays date are enterd
allready.

and
if checkbox1 value = true then textbox1.enable = false




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
checkbox1 linked to sheet1 a1 pswanie Excel Programming 3 January 28th 08 11:42 AM
How can I check if any of the entires is True in a range? Tetsuya Oguma Excel Worksheet Functions 1 March 16th 06 02:37 AM
Formula: If 2 values (in a range of six) are >3 then TRUE, FALSE IFfunction Excel Discussion (Misc queries) 2 October 10th 05 10:34 AM
setting range().hidden=True causes range error 1004 STEVE BELL Excel Programming 6 September 2nd 05 02:16 AM
Checkbox1.LinkedCell = ActiveCell "Why wont this work?& TimeTraveller - ExcelForums.com Excel Programming 2 September 11th 04 09:05 PM


All times are GMT +1. The time now is 08:23 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"