M
Marie J-son
Hi,
I have combobox's directly in the worksheet (not using a form) and on
Worksheet_activate and ws_deactivate I run macros. At first I started with
only the first sub at ws_activate, but the list continued to add items all
the time. Therefore I added the one to clear the list on deactivation.
Please tell me how I should do this in a better way. The list tell how many
columns should be visibel and now every time I activate the ws, all columns
are visible again and the combobox cell is blank (but the list is ok .;-).
Of cource, I want it to stay as it is when I leave the ws, and the right
number of columns should show in the combobox cell :
Please tell me if you know how to do this.
/ Regards
SUBS:
Sub Worksheet_activate()
Application.EnableEvents = False
Application.ScreenUpdating = False
With Blad3.ComboBox1
.AddItem "1 st"
.AddItem "2 st"
.AddItem "3 st"
End With
With Blad3.ComboBox2
.AddItem "1 st"
.AddItem "2 st"
.AddItem "3 st"
.AddItem "4 st"
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Sub Worksheet_deactivate()
Application.EnableEvents = False
Application.ScreenUpdating = False
Blad3.ComboBox1.Clear
Blad3.ComboBox2.Clear
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
I have combobox's directly in the worksheet (not using a form) and on
Worksheet_activate and ws_deactivate I run macros. At first I started with
only the first sub at ws_activate, but the list continued to add items all
the time. Therefore I added the one to clear the list on deactivation.
Please tell me how I should do this in a better way. The list tell how many
columns should be visibel and now every time I activate the ws, all columns
are visible again and the combobox cell is blank (but the list is ok .;-).
Of cource, I want it to stay as it is when I leave the ws, and the right
number of columns should show in the combobox cell :
Please tell me if you know how to do this.
/ Regards
SUBS:
Sub Worksheet_activate()
Application.EnableEvents = False
Application.ScreenUpdating = False
With Blad3.ComboBox1
.AddItem "1 st"
.AddItem "2 st"
.AddItem "3 st"
End With
With Blad3.ComboBox2
.AddItem "1 st"
.AddItem "2 st"
.AddItem "3 st"
.AddItem "4 st"
End With
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub
Sub Worksheet_deactivate()
Application.EnableEvents = False
Application.ScreenUpdating = False
Blad3.ComboBox1.Clear
Blad3.ComboBox2.Clear
Application.EnableEvents = True
Application.ScreenUpdating = True
End Sub