View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Breck Breck is offline
external usenet poster
 
Posts: 54
Default Update check box from cell

I hadn't thought about protecting the structure. Good Idea. The workbook
that I'm creating is for keeping volleyball stats for High School games and
Club Volleyball Tournaments there will be a couple of dozen teams at the
volleyball club that will be using it. I'm just trying to plan for all of
the possibilities that inexperienced users might encounter. If I can't
figure out code I make it so users can't hide or unhide the sheets manually.
I've used macro recorder to get the following code. I just haven't figured
out how to get the Value = xlOn/xlOff to update the check box yet. I'm still
trying. Thanks.

Sub Checked()
' Checked Macro
'
ActiveSheet.Shapes("Check Box 140").Select
With Selection
.Value = xlOn

End With

ActiveCell.Select
End Sub

Sub UnChecked()
' UnChecked Macro
'
ActiveSheet.Shapes("Check Box 140").Select
With Selection
.Value = xlOff
.LinkedCell = ""
.Display3DShading = False
End With
ActiveCell.Select
End Sub


"Dave Peterson" wrote in message
...
You could protect the workbook's structure and make your macro (through
the
checkbox) the only way to hide/unhide a worksheet.

Or maybe you could drop the UDF and just use a workbook event that updates
the
checkbox. I'm not sure how the UDF would be accurate at any particular
point.

Breck wrote:

Yes that is exactly the results that I got. Unfortunately I need the
best of both worlds. I have tried write VBA code but I have just
started 2 weeks ago learning VBA. The last programing class that I had
was in 1972 my first year in college and I failed that course. I need
the check box to return the current status of the sheet because a user
can hide or unhide a sheet by right clicking on the tab. I want the
user to be able to hide "checked" or unhide "not checked" a sheet by
clicking on the check box. I just haven't figured out yet how to have
the check boxed update. I know about the start code when a sheet
become active. I just haven't been able to figure out code to check
for status of a hidden/active sheet in another part of the workbook
and update the check box for that status. thanks for your response.

Breck

On Jan 26, 10:31 am, Dave Peterson wrote:
I put a checkbox from the Forms toolbar on a worksheet.

I rightclicked on the checkbox and chose Format Control|Control tab.

I specified A1 as the cell link.

I put a formula in that cell that evaluated to true or false. When the
cell
returned true, the checkbox was checked. When the formula returned
false, the
checkbox was unchecked.

But be aware that if I checked or unchecked that checkbox manually,
then the
formula in that linked cell was lost.

Breck wrote:

Is there a way to update a check box from a cell?

I have a formula in cell "P3" that returns either True or False. I
would like to have the Check Box "Check Box 140" update to checked if
True or unchecked if False. The formula in cell "P3" is a UDF that
returns True if a sheet is hidden and False if it isn't

--

Dave Peterson


--

Dave Peterson