View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Mike Fogleman[_2_] Mike Fogleman[_2_] is offline
external usenet poster
 
Posts: 206
Default VBA Programming with Checkbox

Both methods work for me using the entire range and the For...Each. On what
line of code are you getting the error?

Mike F
"Premanand Sethuraman" wrote
in message ...
Thanks for your reply and also for explaining the application of "For Each
"
function.
I run the program with this coding but unfortunately still I am getting
the
same error as I explained in my previous post "Application-defined or
object-defined error".
Please guide me whether there should be any requirement error statement in
the above coding.

regards,
premanand.s

"JLGWhiz" wrote:

Last two lines were clipped off.

Sub CheckBox31_Click()
Dim c As Range
If Cells(6, 8).Value = "True" Then
For Each c In Range("C11:P210")
If Not IsEmpty(c) Then
c.Validation.ShowInput = False
End If
Next
Else
For Each c In Range("C11:P210")
If Not IsEmpty(c) Then
c.Validation.ShowInput = True
End If
Next
End If
End Sub


"JLGWhiz" wrote:

Sub CheckBox31_Click()
Dim c As Range
If Cells(6, 8).Value = "True" Then
For Each c In Range("C11:P210")
If Not IsEmpty(c) Then
c.Validation.ShowInput = False
End If
Next
Else
For Each c In Range("C11:P210")
If Not IsEmpty(c) Then
c.Validation.ShowInput = True
End If
Next

"Premanand Sethuraman" wrote:

Dear All,
I am currently doing a program in which I gave inout messages to
nearly all
of the cells in a Single sheet. I kept because this
message/information will
be useful if the user is new person. But my old users don't want the
input
message as it irks always when the entering cells. So I decided to
give one
checkbox in such a way that if he click the checkbox, all the input
messages
of all cells will be hided. If he want the input message back he can
again
click the check box by removing the tick sign in it and after he can
see the
input messages in all the cells. I wrote the foll. coding also for
it.

Sub CheckBox31_Click()
If Cells(6, 8).Value = "True" Then
Range("C11:P210").Validation.ShowInput = False
Else
ActiveSheet.Range("C11:P210").Validation.ShowInput = True
End If
End Sub

But during "Run" it is showing the error as "Application-defined or
object-defined error" which I cannot understand even after entering
the
"help" command.
Please help me to sort out the problem.

Regards,
Premanand.S