Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default 30 CHECK BOXES to be disabled

Dear All

I have more than 30 compartments with a check box. Can you suggest what is
the best way to disable all of them once the compartments are selected and to
enable them only after entering a special password?

The reason for this requirement is, I dont want anyone to inadvertently
change the compartments that are selected for loading.

brgds/captgnvr
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default 30 CHECK BOXES to be disabled

D/Nigel
These compartments are oil tanks. So when I approve certain tanks to load,
duty officer should not change it inadvertently.

So I need a way to block all these 30 odd check boxes locked once the
selection is made and to give a message if accidently uncheck or check these
boxes.

thnks ur response and I kept on looking for response or guidance.

brgds/captgnvr

"Nigel" wrote:

What do you mean 'compartment' ? Is it frame or something else.

--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
Dear All

I have more than 30 compartments with a check box. Can you suggest what
is
the best way to disable all of them once the compartments are selected and
to
enable them only after entering a special password?

The reason for this requirement is, I dont want anyone to inadvertently
change the compartments that are selected for loading.

brgds/captgnvr



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 30 CHECK BOXES to be disabled

So are you saying a checkbox is attached to each oil tank

Regards,
Peter T

"CAPTGNVR" wrote in message
...
D/Nigel
These compartments are oil tanks. So when I approve certain tanks to load,
duty officer should not change it inadvertently.

So I need a way to block all these 30 odd check boxes locked once the
selection is made and to give a message if accidently uncheck or check
these
boxes.

thnks ur response and I kept on looking for response or guidance.

brgds/captgnvr

"Nigel" wrote:

What do you mean 'compartment' ? Is it frame or something else.

--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
Dear All

I have more than 30 compartments with a check box. Can you suggest
what
is
the best way to disable all of them once the compartments are selected
and
to
enable them only after entering a special password?

The reason for this requirement is, I dont want anyone to inadvertently
change the compartments that are selected for loading.

brgds/captgnvr





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default 30 CHECK BOXES to be disabled

D/Nigel and Peter

Will try ur code. In the mean time the following code goes to line 10 and
then goes to end of the program. In debug mode When I place the cursor on
checkboxC it shows as "nothing" assigned. What could be the reason.

Sub CHKTRY()

Dim CheckBoxC As CheckBox
'' Dim CheckBoxC As Excel.CheckBox

' Dim CheckBoxC As MSForms.CheckBox

If ActiveSheet.Range("G70").Value = True Then

10 For Each CheckBoxC In ActiveSheet.CheckBoxes

CheckBoxC.Select = True
CheckBoxC.Enabled = False
Next

End If

Peter reading in, sorry I did not explain in full.
I have about 30 tanks named in each cell and each cell has a check box and
linked to a cell. I pick certain tanks to load the cargo and dont want
anyone to change it. So after I check the tanks to load, I would like to
disable all the check boxes. If any of the duty officer checks or unchecks
message to prop up asking for a uniq password.

brgds/ captgnvr



"Nigel" wrote:

that's a little clearer, so what you actually have is around 30 checkboxes
on a worksheet that you wish to disable

Try this....you must ensure that the checkbox are named CheckBox1, CheckBox2
etc....

Sub LockChecks()
Dim i As Integer
With Worksheets("Sheet1")
For i = 1 To 30
.OLEObjects("CheckBox" & i).Enabled = False
Next i
End With
End Sub


--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
D/Nigel
These compartments are oil tanks. So when I approve certain tanks to load,
duty officer should not change it inadvertently.

So I need a way to block all these 30 odd check boxes locked once the
selection is made and to give a message if accidently uncheck or check
these
boxes.

thnks ur response and I kept on looking for response or guidance.

brgds/captgnvr

"Nigel" wrote:

What do you mean 'compartment' ? Is it frame or something else.

--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
Dear All

I have more than 30 compartments with a check box. Can you suggest
what
is
the best way to disable all of them once the compartments are selected
and
to
enable them only after entering a special password?

The reason for this requirement is, I dont want anyone to inadvertently
change the compartments that are selected for loading.

brgds/captgnvr




  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 30 CHECK BOXES to be disabled

Ah, the compartments are "virtual" oil tanks

Normally to disable checkboxes enabled property you can change all in on go
like this
ActiveSheet.CheckBoxes.Enabled = False ' True to re-enable

however if you disable you can't click and call an onaction macro.

Run LockCBS to assign the Onaction to all checkboxes on the sheet (if you
have some you don't want assigned you'll need to loop individually)

Once the macro is assigned, clicking a checkbox will set its value to what
it was previously, then run a prompt to enter a password, which if correct
will remove the onAction macro from all checkboxes.

When done run LockCBS again.


Sub LockCBS()
ActiveSheet.CheckBoxes.OnAction = "GetPW"
End Sub

Sub GetPW()
Dim vAns
On Error Resume Next
With ActiveSheet.CheckBoxes(Application.Caller)
.Value = IIf(.Value = xlOn, xlOff, xlOn)
End With
On Error GoTo 0

vAns = Application.InputBox("Enter password", "my title")
If LCase(vAns) = "hello" Then
ActiveSheet.CheckBoxes.OnAction = ""
MsgBox "Checkboxes enabled"
ElseIf vAns = False Then
Else: MsgBox "invalid password, hint - Hi"
End If

End Sub


Regards,
Peter T


"CAPTGNVR" wrote in message
...
D/Nigel and Peter

Will try ur code. In the mean time the following code goes to line 10 and
then goes to end of the program. In debug mode When I place the cursor
on
checkboxC it shows as "nothing" assigned. What could be the reason.

Sub CHKTRY()

Dim CheckBoxC As CheckBox
'' Dim CheckBoxC As Excel.CheckBox

' Dim CheckBoxC As MSForms.CheckBox

If ActiveSheet.Range("G70").Value = True Then

10 For Each CheckBoxC In ActiveSheet.CheckBoxes

CheckBoxC.Select = True
CheckBoxC.Enabled = False
Next

End If

Peter reading in, sorry I did not explain in full.
I have about 30 tanks named in each cell and each cell has a check box and
linked to a cell. I pick certain tanks to load the cargo and dont want
anyone to change it. So after I check the tanks to load, I would like to
disable all the check boxes. If any of the duty officer checks or
unchecks
message to prop up asking for a uniq password.

brgds/ captgnvr



"Nigel" wrote:

that's a little clearer, so what you actually have is around 30
checkboxes
on a worksheet that you wish to disable

Try this....you must ensure that the checkbox are named CheckBox1,
CheckBox2
etc....

Sub LockChecks()
Dim i As Integer
With Worksheets("Sheet1")
For i = 1 To 30
.OLEObjects("CheckBox" & i).Enabled = False
Next i
End With
End Sub


--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
D/Nigel
These compartments are oil tanks. So when I approve certain tanks to
load,
duty officer should not change it inadvertently.

So I need a way to block all these 30 odd check boxes locked once the
selection is made and to give a message if accidently uncheck or check
these
boxes.

thnks ur response and I kept on looking for response or guidance.

brgds/captgnvr

"Nigel" wrote:

What do you mean 'compartment' ? Is it frame or something else.

--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
Dear All

I have more than 30 compartments with a check box. Can you suggest
what
is
the best way to disable all of them once the compartments are
selected
and
to
enable them only after entering a special password?

The reason for this requirement is, I dont want anyone to
inadvertently
change the compartments that are selected for loading.

brgds/captgnvr






  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 87
Default 30 CHECK BOXES to be disabled

D/Peter
Thanks for quick follow up. I quickly tried on a sample sheet and works a
charm. I will incorporate it in my real program and revert. Thank you so
much -- especially for making it most simplest.

For knowledge sake is it possible to let me know how to loop if I want to
permit only the marked check boxes tanks?

brgds/captgnvr


"Peter T" wrote:

Ah, the compartments are "virtual" oil tanks

Normally to disable checkboxes enabled property you can change all in on go
like this
ActiveSheet.CheckBoxes.Enabled = False ' True to re-enable

however if you disable you can't click and call an onaction macro.

Run LockCBS to assign the Onaction to all checkboxes on the sheet (if you
have some you don't want assigned you'll need to loop individually)

Once the macro is assigned, clicking a checkbox will set its value to what
it was previously, then run a prompt to enter a password, which if correct
will remove the onAction macro from all checkboxes.

When done run LockCBS again.


Sub LockCBS()
ActiveSheet.CheckBoxes.OnAction = "GetPW"
End Sub

Sub GetPW()
Dim vAns
On Error Resume Next
With ActiveSheet.CheckBoxes(Application.Caller)
.Value = IIf(.Value = xlOn, xlOff, xlOn)
End With
On Error GoTo 0

vAns = Application.InputBox("Enter password", "my title")
If LCase(vAns) = "hello" Then
ActiveSheet.CheckBoxes.OnAction = ""
MsgBox "Checkboxes enabled"
ElseIf vAns = False Then
Else: MsgBox "invalid password, hint - Hi"
End If

End Sub


Regards,
Peter T


"CAPTGNVR" wrote in message
...
D/Nigel and Peter

Will try ur code. In the mean time the following code goes to line 10 and
then goes to end of the program. In debug mode When I place the cursor
on
checkboxC it shows as "nothing" assigned. What could be the reason.

Sub CHKTRY()

Dim CheckBoxC As CheckBox
'' Dim CheckBoxC As Excel.CheckBox

' Dim CheckBoxC As MSForms.CheckBox

If ActiveSheet.Range("G70").Value = True Then

10 For Each CheckBoxC In ActiveSheet.CheckBoxes

CheckBoxC.Select = True
CheckBoxC.Enabled = False
Next

End If

Peter reading in, sorry I did not explain in full.
I have about 30 tanks named in each cell and each cell has a check box and
linked to a cell. I pick certain tanks to load the cargo and dont want
anyone to change it. So after I check the tanks to load, I would like to
disable all the check boxes. If any of the duty officer checks or
unchecks
message to prop up asking for a uniq password.

brgds/ captgnvr



"Nigel" wrote:

that's a little clearer, so what you actually have is around 30
checkboxes
on a worksheet that you wish to disable

Try this....you must ensure that the checkbox are named CheckBox1,
CheckBox2
etc....

Sub LockChecks()
Dim i As Integer
With Worksheets("Sheet1")
For i = 1 To 30
.OLEObjects("CheckBox" & i).Enabled = False
Next i
End With
End Sub


--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
D/Nigel
These compartments are oil tanks. So when I approve certain tanks to
load,
duty officer should not change it inadvertently.

So I need a way to block all these 30 odd check boxes locked once the
selection is made and to give a message if accidently uncheck or check
these
boxes.

thnks ur response and I kept on looking for response or guidance.

brgds/captgnvr

"Nigel" wrote:

What do you mean 'compartment' ? Is it frame or something else.

--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
Dear All

I have more than 30 compartments with a check box. Can you suggest
what
is
the best way to disable all of them once the compartments are
selected
and
to
enable them only after entering a special password?

The reason for this requirement is, I dont want anyone to
inadvertently
change the compartments that are selected for loading.

brgds/captgnvr







  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default 30 CHECK BOXES to be disabled

If by "marked" you mean ticked

dim cbx as checkbox

for each cbx in activesheet.checkboxes
if cbx.value = xlOn then
' code, eg
' cbx.onaction = "LockCBS"
end if
next

typed into this reply / not tested

Regards,
Peter T



"CAPTGNVR" wrote in message
...
D/Peter
Thanks for quick follow up. I quickly tried on a sample sheet and works a
charm. I will incorporate it in my real program and revert. Thank you so
much -- especially for making it most simplest.

For knowledge sake is it possible to let me know how to loop if I want to
permit only the marked check boxes tanks?

brgds/captgnvr


"Peter T" wrote:

Ah, the compartments are "virtual" oil tanks

Normally to disable checkboxes enabled property you can change all in on
go
like this
ActiveSheet.CheckBoxes.Enabled = False ' True to re-enable

however if you disable you can't click and call an onaction macro.

Run LockCBS to assign the Onaction to all checkboxes on the sheet (if you
have some you don't want assigned you'll need to loop individually)

Once the macro is assigned, clicking a checkbox will set its value to
what
it was previously, then run a prompt to enter a password, which if
correct
will remove the onAction macro from all checkboxes.

When done run LockCBS again.


Sub LockCBS()
ActiveSheet.CheckBoxes.OnAction = "GetPW"
End Sub

Sub GetPW()
Dim vAns
On Error Resume Next
With ActiveSheet.CheckBoxes(Application.Caller)
.Value = IIf(.Value = xlOn, xlOff, xlOn)
End With
On Error GoTo 0

vAns = Application.InputBox("Enter password", "my title")
If LCase(vAns) = "hello" Then
ActiveSheet.CheckBoxes.OnAction = ""
MsgBox "Checkboxes enabled"
ElseIf vAns = False Then
Else: MsgBox "invalid password, hint - Hi"
End If

End Sub


Regards,
Peter T


"CAPTGNVR" wrote in message
...
D/Nigel and Peter

Will try ur code. In the mean time the following code goes to line 10
and
then goes to end of the program. In debug mode When I place the
cursor
on
checkboxC it shows as "nothing" assigned. What could be the reason.

Sub CHKTRY()

Dim CheckBoxC As CheckBox
'' Dim CheckBoxC As Excel.CheckBox

' Dim CheckBoxC As MSForms.CheckBox

If ActiveSheet.Range("G70").Value = True Then

10 For Each CheckBoxC In ActiveSheet.CheckBoxes

CheckBoxC.Select = True
CheckBoxC.Enabled = False
Next

End If

Peter reading in, sorry I did not explain in full.
I have about 30 tanks named in each cell and each cell has a check box
and
linked to a cell. I pick certain tanks to load the cargo and dont want
anyone to change it. So after I check the tanks to load, I would like
to
disable all the check boxes. If any of the duty officer checks or
unchecks
message to prop up asking for a uniq password.

brgds/ captgnvr



"Nigel" wrote:

that's a little clearer, so what you actually have is around 30
checkboxes
on a worksheet that you wish to disable

Try this....you must ensure that the checkbox are named CheckBox1,
CheckBox2
etc....

Sub LockChecks()
Dim i As Integer
With Worksheets("Sheet1")
For i = 1 To 30
.OLEObjects("CheckBox" & i).Enabled = False
Next i
End With
End Sub


--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
D/Nigel
These compartments are oil tanks. So when I approve certain tanks to
load,
duty officer should not change it inadvertently.

So I need a way to block all these 30 odd check boxes locked once
the
selection is made and to give a message if accidently uncheck or
check
these
boxes.

thnks ur response and I kept on looking for response or guidance.

brgds/captgnvr

"Nigel" wrote:

What do you mean 'compartment' ? Is it frame or something else.

--

Regards,
Nigel




"CAPTGNVR" wrote in message
...
Dear All

I have more than 30 compartments with a check box. Can you
suggest
what
is
the best way to disable all of them once the compartments are
selected
and
to
enable them only after entering a special password?

The reason for this requirement is, I dont want anyone to
inadvertently
change the compartments that are selected for loading.

brgds/captgnvr









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
Copy and move check box (check boxes) with new cell link? Marty Excel Worksheet Functions 1 January 20th 10 07:43 PM
Enable check box in protected sheet + group check boxes Dexxterr Excel Discussion (Misc queries) 4 August 2nd 06 12:00 PM
vba check for disabled macros Ray Maas Excel Programming 2 June 8th 06 03:56 PM
How do i create a value for check boxes or option boxes Tim wr Excel Discussion (Misc queries) 1 February 9th 06 10:29 PM
disabled check boxes chinita Excel Discussion (Misc queries) 3 June 18th 05 06:07 PM


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