PC Review


Reply
Thread Tools Rate Thread

checkbox1 value = true if range got data

 
 
pswanie
Guest
Posts: n/a
 
      4th Feb 2008
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 With Quote
 
 
 
 
Mike Fogleman
Guest
Posts: n/a
 
      4th Feb 2008
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" <(E-Mail Removed)> wrote in message
news:2A852634-F97B-423D-9AB6-(E-Mail Removed)...
>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 With Quote
 
 
 
 
Chip Pearson
Guest
Posts: n/a
 
      5th Feb 2008
Try some code like the following:

Dim R As Range
Dim B As Boolean
For Each R In Worksheets("Sheet1").Range("D131") '<<< 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" <(E-Mail Removed)> wrote in message
news:2A852634-F97B-423D-9AB6-(E-Mail Removed)...
>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 With Quote
 
pswanie
Guest
Posts: n/a
 
      5th Feb 2008
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("D131") '<<< 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" <(E-Mail Removed)> wrote in message
> news:2A852634-F97B-423D-9AB6-(E-Mail Removed)...
> >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 With Quote
 
Chip Pearson
Guest
Posts: n/a
 
      6th Feb 2008
> 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" <(E-Mail Removed)> wrote in message
news:9738FD5C-D008-4DA5-A55A-(E-Mail Removed)...
> 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("D131") '<<< 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" <(E-Mail Removed)> wrote in message
>> news:2A852634-F97B-423D-9AB6-(E-Mail Removed)...
>> >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 With Quote
 
Mike Fogleman
Guest
Posts: n/a
 
      6th Feb 2008
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" <(E-Mail Removed)> wrote in message
news:B9776BD2-4223-40B1-AF06-(E-Mail Removed)...
>> 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" <(E-Mail Removed)> wrote in message
> news:9738FD5C-D008-4DA5-A55A-(E-Mail Removed)...
>> 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("D131") '<<< 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" <(E-Mail Removed)> wrote in message
>>> news:2A852634-F97B-423D-9AB6-(E-Mail Removed)...
>>> >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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
WPF equivalence to checkBox1.AutoCheck = false Maximilian Microsoft Dot NET Framework 1 14th May 2008 07:31 PM
checkbox1 linked to sheet1 a1 pswanie Microsoft Excel Programming 3 28th Jan 2008 12:42 PM
Checkbox1.LinkedCell = ActiveCell "Why wont this work?& TimeTraveller - ExcelForums.com Microsoft Excel Programming 2 11th Sep 2004 09:05 PM
Checkbox1.LinkedCel = ActiveCell -- "Why wont it work?" Time Traveller Microsoft Excel Discussion 1 11th Sep 2004 09:03 PM
how to retrieved value from xml to checkbox1............ Supra Microsoft Dot NET 1 3rd Aug 2004 09:34 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 09:18 AM.