Linking labels to cells and turning off events in userform

R

routeram

Hi all of you,

2 Questions:

I want to show the contents of a particular cell in a label on th
userform. How do I do it? Is it possible to link the caption to th
cell so that if the cell changes, the label will change too?

Also I do some intialisation of scrollbars during th
userform_initialise. But I don't want the scrollbar_change event to ru
during initialisation. Is there a way to switch off the events in th
userform and enable them again at the end of the initialisatio
routine? (Purely for speeding up the code). Any work arounds?

Thanks a lot. You guys are great!


Regards,
Ra
 
S

Stephen Bullen

Hi Routeram,
Also I do some intialisation of scrollbars during the
userform_initialise. But I don't want the scrollbar_change event to run
during initialisation. Is there a way to switch off the events in the
userform and enable them again at the end of the initialisation
routine? (Purely for speeding up the code). Any work arounds?

You have to do it yourself, generally using a module-level variable:

Dim mbNoEvents As Boolean

Private Sub Userform_Initialize()

mbNoEvents = True

'Do your stuff

mbNoEvents = False
End Sub

Private Sub ScrollBar1_Change()

If mbNoEvents Then Exit Sub

'Do your stuff

End Sub

Regards

Stephen Bullen
Microsoft MVP - Excel
www.oaltd.co.uk
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top