Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.misc
tg tg is offline
external usenet poster
 
Posts: 58
Default Check box not working out for me.. why?

Hi,

I am using a check box and sending the true or false value to another
spreadsheet (at cell A2), I am then using the following code:

If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If

this code does not work using the check box to send a true or false value,
it does however work when I manually type in false or true.....???

Can any one help me with this one?

Thank you guys in advance,

TG
  #2   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Check box not working out for me.. why?

You left out part of your macro, specifically which event are you using!
However, as changing an object is not detected by events, I don't think you
are heading in the right direction. Perhaps you could use the
worksheet_Activate event, and then have it check range "a2" of the
appropriate sheet and decide whether to hide the rows or not.

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"TG" wrote:

Hi,

I am using a check box and sending the true or false value to another
spreadsheet (at cell A2), I am then using the following code:

If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If

this code does not work using the check box to send a true or false value,
it does however work when I manually type in false or true.....???

Can any one help me with this one?

Thank you guys in advance,

TG

  #3   Report Post  
Posted to microsoft.public.excel.misc
tg tg is offline
external usenet poster
 
Posts: 58
Default Check box not working out for me.. why?

Sorry,

here is what I am using:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If
End Sub


and still it does not work

TIA

TG






"Luke M" wrote:

You left out part of your macro, specifically which event are you using!
However, as changing an object is not detected by events, I don't think you
are heading in the right direction. Perhaps you could use the
worksheet_Activate event, and then have it check range "a2" of the
appropriate sheet and decide whether to hide the rows or not.

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"TG" wrote:

Hi,

I am using a check box and sending the true or false value to another
spreadsheet (at cell A2), I am then using the following code:

If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If

this code does not work using the check box to send a true or false value,
it does however work when I manually type in false or true.....???

Can any one help me with this one?

Thank you guys in advance,

TG

  #4   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 2,722
Default Check box not working out for me.. why?

Yea, the worksheet change event is not activated by checkboxes. As I
mentioned before, you could try doing a late event where whenever you
activate the sheet that's important, use the worksheet activate event to call
a macro from a module that goes back to sheet with TRUE/FALSE, checks value,
hides/unhides rows, and then returns to start sheet.

Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Call MyMacro
Me.Select
End Sub


--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"TG" wrote:

Sorry,

here is what I am using:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If
End Sub


and still it does not work

TIA

TG






"Luke M" wrote:

You left out part of your macro, specifically which event are you using!
However, as changing an object is not detected by events, I don't think you
are heading in the right direction. Perhaps you could use the
worksheet_Activate event, and then have it check range "a2" of the
appropriate sheet and decide whether to hide the rows or not.

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"TG" wrote:

Hi,

I am using a check box and sending the true or false value to another
spreadsheet (at cell A2), I am then using the following code:

If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If

this code does not work using the check box to send a true or false value,
it does however work when I manually type in false or true.....???

Can any one help me with this one?

Thank you guys in advance,

TG

  #5   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 35,218
Default Check box not working out for me.. why?

You can use code directly associated with the checkbox.

I'm assuming that your checkbox is from the Control toolbox toolbar. If it's
not, then replace it with one that is from that toolbar.

My checkbox was named Checkbox1:

Option Explicit
Private Sub CheckBox1_Click()
Me.Rows("5:56").Hidden = Not (Me.CheckBox1.Value)
End Sub

This code goes in the module for the worksheet that owns the checkbox (and rows
to hide).



TG wrote:

Hi,

I am using a check box and sending the true or false value to another
spreadsheet (at cell A2), I am then using the following code:

If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If

this code does not work using the check box to send a true or false value,
it does however work when I manually type in false or true.....???

Can any one help me with this one?

Thank you guys in advance,

TG


--

Dave Peterson


  #6   Report Post  
Posted to microsoft.public.excel.misc
external usenet poster
 
Posts: 15,768
Default Check box not working out for me.. why?

This kludge works:

A2 = linked cell
A1 formula: =--A2

Private Sub Worksheet_Calculate()

If Range("A1").Value = 0 Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If

End Sub

But I like Dave's suggestion!

--
Biff
Microsoft Excel MVP


"Luke M" wrote in message
...
Yea, the worksheet change event is not activated by checkboxes. As I
mentioned before, you could try doing a late event where whenever you
activate the sheet that's important, use the worksheet activate event to
call
a macro from a module that goes back to sheet with TRUE/FALSE, checks
value,
hides/unhides rows, and then returns to start sheet.

Private Sub Worksheet_Activate()
Application.ScreenUpdating = False
Call MyMacro
Me.Select
End Sub


--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"TG" wrote:

Sorry,

here is what I am using:

Private Sub Worksheet_Change(ByVal Target As Range)
If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If
End Sub


and still it does not work

TIA

TG






"Luke M" wrote:

You left out part of your macro, specifically which event are you
using!
However, as changing an object is not detected by events, I don't think
you
are heading in the right direction. Perhaps you could use the
worksheet_Activate event, and then have it check range "a2" of the
appropriate sheet and decide whether to hide the rows or not.

--
Best Regards,

Luke M
*Remember to click "yes" if this post helped you!*


"TG" wrote:

Hi,

I am using a check box and sending the true or false value to another
spreadsheet (at cell A2), I am then using the following code:

If Target.Address = "$A$2" Then
If UCase(Target.Value) = "FALSE" Then
Rows("5:56").Hidden = True
Else
Rows("5:56").Hidden = False
End If
End If

this code does not work using the check box to send a true or false
value,
it does however work when I manually type in false or true.....???

Can any one help me with this one?

Thank you guys in advance,

TG



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
Check Box not working HR Sam Excel Discussion (Misc queries) 1 October 20th 08 10:27 PM
Check Box Not working? Anand vijay New Users to Excel 3 January 6th 07 03:34 AM
check box not working on excel spreadsheet? Lissette Excel Worksheet Functions 3 March 11th 06 12:44 PM
How can I protect a cell and keep the spell check working? ochoaex Excel Discussion (Misc queries) 1 February 3rd 06 08:25 PM
How do I enter a working check box option in Excel? Lisa the CPA Excel Discussion (Misc queries) 1 January 31st 05 07:07 AM


All times are GMT +1. The time now is 05:51 PM.

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"