View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Gary Keramidas Gary Keramidas is offline
external usenet poster
 
Posts: 2,494
Default Workbook activate help

are you speaking about the label? if so, i was just showing 2 different
ways. set the label on the form, or add the line of code if the op wants to
have the label update which sheet it's on while it's running. the label
won't be permanently updated with the code.

sorry for the confusion.

--

Gary Keramidas
Excel 2003


"OssieMac" wrote in message
...
I'll stand correcting on this but I thought that controls lost any
properties
set with code as soon as the code had finished running and the only way to
have permanent properties is to set them manually with the controls dialog
box.

--
Regards,

OssieMac


"Gary Keramidas" wrote:

not sure exactly what you need. but this may help. create a new form, i
used
userform1. put a label on it with the text you want displayed "Workbook
Loading.." and format it however you want it to look.

then paste this code on the thisworkbook code page. this is untested and
there is no error checking:
added line numbers so you can tell where it wraps. the line #'s are on
consecutive lines.



Option Explicit

Private Sub Workbook_Open()
Dim GrpBox As GroupBox
Dim OptBtn As OptionButton
Dim ws As Worksheet
10 For Each ws In ThisWorkbook.Worksheets
20 With UserForm1
30 .Show vbModal = False
40 .Label1 = "Working on sheet " & ws.Name 'if you
want
updating text for each sheet
50 End With
60 DoEvents ' use this to change the label text during
the
opening
70 For Each OptBtn In ws.OptionButtons
80 With OptBtn
90 .LinkedCell = .GroupBox.TopLeftCell.Address
100 End With
110 Next
120 Next
130 Unload UserForm1
End Sub


--

Gary Keramidas
Excel 2003


"dgold82" wrote in message
...
With the help of the community here I was able to find code that helped
me
link hundreds of radio buttons on multiple worksheets to cells with a
macro.
I am running into a strange situation where sometimes the links are
broken
and I have to run the macro again (why is that happening?).

To ease my mind I would like to change the code to the workbook
activate
event and have it run each time I open the workbook. I would like to
change
the code to run on multiple worksheets (now it just has active
worksheet).
Can someone please help me with my code below, I am a beginner with
VBA:

Sub LinkOptBtns()
Dim GrpBox As GroupBox
Dim OptBtn As OptionButton
For Each OptBtn In ActiveSheet.OptionButtons
With OptBtn
.LinkedCell = .GroupBox.TopLeftCell.Address
End With
Next
End Sub

Also, if someone knows a way to add a message box that automatically
opens
to says something like "workbook loading..." and then close when the
macro
completes that would be great!!!

Thanks!