Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default CheckBox VBA Issue

Hello,
I have a UserForm that has lots of command buttons, listboxes, comboboxes,
and 4 checkboxes. I need the 4 checkboxes to show as checked if there's a
value in certain cells. 2 of these are no problem since it's the letter "P".
The other 2 however I'm having trouble with since they will (or will not)
have a value in them. I've come up with a code that works if there's any
value but 0 in it, but not if there is. Here's what I came up with for the 2
I'm having trouble with:

Private Sub UserForm_Activate()

If ActiveSheet.Range("T8") < 0 Then
Me.CheckBox5.Value = True
End If
If ActiveSheet.Range("T55") < 0 Then
Me.CheckBox4.Value = True
End If

End Sub

I'm sure it's just a digit or two, but I can't get it to work. Any help would
be appreciated, and thank you in advance.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200810/1

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 897
Default CheckBox VBA Issue

Maybe it's just me, but I can't tell what specifically would trigger
the checkboxes to be checked (i.e. what the problem is). Can you state
clearly under what conditions the checkboxes need to be checked?

--JP


On Oct 13, 3:46*pm, "Joe_Hunt via OfficeKB.com" <u45578@uwe wrote:
Hello,
I have a UserForm that has lots of command buttons, listboxes, comboboxes,
and 4 checkboxes. I need the 4 checkboxes to show as checked if there's a
value in certain cells. 2 of these are no problem since it's the letter "P".
The other 2 however I'm having trouble with since they will (or will not)
have a value in them. I've come up with a code that works if there's any
value but 0 in it, but not if there is. Here's what I came up with for the 2
I'm having trouble with:

Private Sub UserForm_Activate()

* * If ActiveSheet.Range("T8") < 0 Then
* * * * Me.CheckBox5.Value = True
* * End If
* * If ActiveSheet.Range("T55") < 0 Then
* * * * Me.CheckBox4.Value = True
* * End If

End Sub

I'm sure it's just a digit or two, but I can't get it to work. Any help would
be appreciated, and thank you in advance.

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default CheckBox VBA Issue

You might want to add a line like:

Else
Me.CheckBox5.Value = False

to your If...Then statements. That way if they had previously been True but
the value was changed to zero or "" then it would display unchecked.

\

"Joe_Hunt via OfficeKB.com" wrote:

Hello,
I have a UserForm that has lots of command buttons, listboxes, comboboxes,
and 4 checkboxes. I need the 4 checkboxes to show as checked if there's a
value in certain cells. 2 of these are no problem since it's the letter "P".
The other 2 however I'm having trouble with since they will (or will not)
have a value in them. I've come up with a code that works if there's any
value but 0 in it, but not if there is. Here's what I came up with for the 2
I'm having trouble with:

Private Sub UserForm_Activate()

If ActiveSheet.Range("T8") < 0 Then
Me.CheckBox5.Value = True
End If
If ActiveSheet.Range("T55") < 0 Then
Me.CheckBox4.Value = True
End If

End Sub

I'm sure it's just a digit or two, but I can't get it to work. Any help would
be appreciated, and thank you in advance.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200810/1


  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default CheckBox VBA Issue

Well, that was a good idea but it didn't work. I've noticed another problem
now that I think is related. I'm not sure how to word it so I'll repost once
I can get my head around it. Thanks to both JP and JLGWhiz for trying.

JLGWhiz wrote:
You might want to add a line like:

Else
Me.CheckBox5.Value = False

to your If...Then statements. That way if they had previously been True but
the value was changed to zero or "" then it would display unchecked.

\

Hello,
I have a UserForm that has lots of command buttons, listboxes, comboboxes,

[quoted text clipped - 18 lines]
I'm sure it's just a digit or two, but I can't get it to work. Any help would
be appreciated, and thank you in advance.


--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200810/1

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 35,218
Default CheckBox VBA Issue

Maybe you want to check to see if the cell is empty:

if isempty(activesheet.range("t8").value) then
or
if activesheet.range("t8").value = "" then

But I'm not sure I understand the real question.

"Joe_Hunt via OfficeKB.com" wrote:

Hello,
I have a UserForm that has lots of command buttons, listboxes, comboboxes,
and 4 checkboxes. I need the 4 checkboxes to show as checked if there's a
value in certain cells. 2 of these are no problem since it's the letter "P".
The other 2 however I'm having trouble with since they will (or will not)
have a value in them. I've come up with a code that works if there's any
value but 0 in it, but not if there is. Here's what I came up with for the 2
I'm having trouble with:

Private Sub UserForm_Activate()

If ActiveSheet.Range("T8") < 0 Then
Me.CheckBox5.Value = True
End If
If ActiveSheet.Range("T55") < 0 Then
Me.CheckBox4.Value = True
End If

End Sub

I'm sure it's just a digit or two, but I can't get it to work. Any help would
be appreciated, and thank you in advance.

--
Message posted via OfficeKB.com
http://www.officekb.com/Uwe/Forums.a...mming/200810/1


--

Dave Peterson
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
How to have Checkbox A uncheck with checked Checkbox B Texas Aggie Excel Discussion (Misc queries) 3 July 20th 07 10:58 PM
link a checkbox in a sheet to a checkbox on a userform? Arjan Excel Programming 0 November 10th 06 01:37 PM
How do I link one checkbox to update another checkbox? Mike Excel Programming 3 April 28th 06 02:22 AM
checkbox on form reset from checkbox on sheet raw[_12_] Excel Programming 1 December 3rd 05 05:08 AM
checkbox Paul P Excel Programming 0 September 10th 03 08:56 PM


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

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

About Us

"It's about Microsoft Excel"