ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Linking labels to cells and turning off events in userform (https://www.excelbanter.com/excel-programming/316673-linking-labels-cells-turning-off-events-userform.html)

routeram[_8_]

Linking labels to cells and turning off events in userform
 

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

--
routera
-----------------------------------------------------------------------
routeram's Profile: http://www.excelforum.com/member.php...fo&userid=1045
View this thread: http://www.excelforum.com/showthread.php?threadid=27793


mangesh_yadav[_193_]

Linking labels to cells and turning off events in userform
 

for the first:
lable1.caption = Worksheets("Sheet1").Range("A1"

--
mangesh_yada

-----------------------------------------------------------------------
mangesh_yadav's Profile: http://www.excelforum.com/member.php...fo&userid=1047
View this thread: http://www.excelforum.com/showthread.php?threadid=27793


Stephen Bullen[_4_]

Linking labels to cells and turning off events in userform
 
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




All times are GMT +1. The time now is 11:18 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com