Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checkbox locked and will not unlock


Hello

I have a checkbox that i only want to become unlocked when a number is
put in this is my code
Private Sub CheckBox1_Click()

If ("N22") = "1" Or "2" Or "3" Then
CheckBox1.Value = False
CheckBox1.Enabled = False
Else
CheckBox1.Value = False
CheckBox1.Enabled = True

End If



End Sub

But it only works once and when you put other numbers in it still
remains locked??????


--
Rmagic
------------------------------------------------------------------------
Rmagic's Profile: http://www.excelforum.com/member.php...o&userid=28595
View this thread: http://www.excelforum.com/showthread...hreadid=484673

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Checkbox locked and will not unlock

Private Sub CheckBox1_Click()

If Range("N22").Text = "1" Or _
Range("N22").text = "2" Or _
Range("N22").text = "3" Then
CheckBox1.Value = False
CheckBox1.Enabled = False
Else
CheckBox1.Value = False
CheckBox1.Enabled = True

End If
End Sub

--
Regards,
Tom Ogilvy


"Rmagic" wrote in
message ...

Hello

I have a checkbox that i only want to become unlocked when a number is
put in this is my code
Private Sub CheckBox1_Click()

If ("N22") = "1" Or "2" Or "3" Then
CheckBox1.Value = False
CheckBox1.Enabled = False
Else
CheckBox1.Value = False
CheckBox1.Enabled = True

End If



End Sub

But it only works once and when you put other numbers in it still
remains locked??????


--
Rmagic
------------------------------------------------------------------------
Rmagic's Profile:

http://www.excelforum.com/member.php...o&userid=28595
View this thread: http://www.excelforum.com/showthread...hreadid=484673



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Checkbox locked and will not unlock


Hi i have tried the code (thanks for that)


Private Sub CheckBox1_Click()

If Range("N22").Text = "1" Or _
Range("N22").text = "2" Or _
Range("N22").text = "3" Then
CheckBox1.Value = False
CheckBox1.Enabled = False
Else
CheckBox1.Value = False
CheckBox1.Enabled = True

End If
End Sub


But it only works once and still remains locked after change the numbe
to say 4 or 5

Thank

--
Rmagi
-----------------------------------------------------------------------
Rmagic's Profile: http://www.excelforum.com/member.php...fo&userid=2859
View this thread: http://www.excelforum.com/showthread.php?threadid=48467

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Checkbox locked and will not unlock

I only straightened out your existing code. I didn't comment on the logic
you are employing.

If the checkbox is not enabled, then you can not fire the click event and
re-enable the control. You will need to use the Change event or the
Calculate event of the worksheets to reenable the control (and possibly
disable it).

--
Regards,
Tom Ogilvy


"Rmagic" wrote in
message ...

Hi i have tried the code (thanks for that)


Private Sub CheckBox1_Click()

If Range("N22").Text = "1" Or _
Range("N22").text = "2" Or _
Range("N22").text = "3" Then
CheckBox1.Value = False
CheckBox1.Enabled = False
Else
CheckBox1.Value = False
CheckBox1.Enabled = True

End If
End Sub


But it only works once and still remains locked after change the number
to say 4 or 5

Thanks


--
Rmagic
------------------------------------------------------------------------
Rmagic's Profile:

http://www.excelforum.com/member.php...o&userid=28595
View this thread: http://www.excelforum.com/showthread...hreadid=484673



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
Personal.XLS is locked for editing. How to unlock it? shorns Excel Discussion (Misc queries) 1 January 14th 10 07:30 PM
How unlock locked cells Robin Excel Discussion (Misc queries) 2 August 24th 09 03:16 AM
How do I 'unlock' it when it says my document is locked? sdl121 Excel Discussion (Misc queries) 1 April 26th 06 02:01 AM
Unlock, locked spreadsheet dominicb Excel Discussion (Misc queries) 1 September 16th 05 06:20 PM
some keys locked on keyboard. How do I unlock it? Dalene Excel Discussion (Misc queries) 2 April 3rd 05 07:19 PM


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