BeforeSave, Screenupdating = False, Why is it not working

  • Thread starter Thread starter Claus
  • Start date Start date
C

Claus

Hello

I want to set Screenupdating = False before saving, because i've got 12
sheets with aprox. 1000 rows, and i see the sheet changing while saving.

I did like this and it dosent work:

Private Sub Workbook_BeforeSave()
Application.ScreenUpdating = False
End Sub


How do i turn on Screenupdating after saving ?


Kind Regards

Claus
 
Application.screenupdating will turn back to true when the routine ends.

But you must have other code running--I've never seen saving a workbook change
active worksheets.
 
Hi Dave

Thanks for your mail.

I've found out that, when saving, the program is running code belonging to a
ComboBox_Change Sub even though the combo neither have focus nor has
changed. The Sub is also running when copying sheets from one workbook to
another.

I have no code with BeforeSave.

Do you have any suggestions to what migth be the problem.



Claus Persson
 
I think I've read posts that this can happen if the combobox has a linked cell.
Do you have a linked cell?

Can you get rid of it and just populate that cell in code?
 
The Combo has no linked cell, but i have togglebuttons with linked cells.
When the combo is deleted the problem disapears.

LinkedCell is empty
ListFillRange is a Name referring to another sheet range O5:P8

Claus
 
How about removing the listfillrange and seeing what happens?
The Combo has no linked cell, but i have togglebuttons with linked cells.
When the combo is deleted the problem disapears.

LinkedCell is empty
ListFillRange is a Name referring to another sheet range O5:P8

Claus
 
It seems to solve the problem, but how do I fill in the content of the combo
then ?

Claus
 
Maybe you could use some code--when the workbook is opened?

Option Explicit
Private Sub Workbook_Open()

Dim myRng As Range
Dim myCell As Range

With Sheet1
Set myRng = .Range("a1", .Cells(.Rows.Count, "A").End(xlUp))
With .ComboBox1
For Each myCell In myRng.Cells
.AddItem myCell.Text
Next myCell
End With
End With

End Sub


It seems to solve the problem, but how do I fill in the content of the combo
then ?

Claus
 
Thanks Dave

It worked.
Looks like this now:

Option Explicit
Private Sub Workbook_Open()
Dim myRng As Range
Dim myCell As Range

Set myRng = Sheets("Data").Range("P5", "P8")
Sheets("E1").ComboBoxVis.Clear
With Sheets("E1").ComboBoxVis
For Each myCell In myRng.Cells
.AddItem myCell.Text
Next myCell
End With
End Sub


I will add code so that it is done for all my sheets from "E1" to "E12" when
i've made them.

Claus
 
Glad you got it working.
Thanks Dave

It worked.
Looks like this now:

Option Explicit
Private Sub Workbook_Open()
Dim myRng As Range
Dim myCell As Range

Set myRng = Sheets("Data").Range("P5", "P8")
Sheets("E1").ComboBoxVis.Clear
With Sheets("E1").ComboBoxVis
For Each myCell In myRng.Cells
.AddItem myCell.Text
Next myCell
End With
End Sub

I will add code so that it is done for all my sheets from "E1" to "E12" when
i've made them.

Claus
 
Back
Top