ComboBox: ListFillRange, Active WorkBook: CloseButton

Stromma

Board Regular
Joined
Feb 8, 2004
Messages
240
Hi All:

I use this to set the ListFillRange for ComboBox10:

With ComboBox10
.List = Sheets("Artikel").Range("A2:A5002").Value
.ListIndex = -1
End With

I want to use the same ListFillRange for ComboBox13, 18, 23, 27 and 32.

Do i have to set the ListFillRange for each ComboBox separately?

To prevent users from using the close button (x) in the UserForm i use:

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
If CloseMode = 0 Then
Cancel = True
MsgBox "InActivated!", vbCritical, "Microsoft Excel"
End If
End Sub

Is it possible use something similar to force users to close the workbook with a CommandButton?

Ex:
Sub Close()
ActiveWorkBook.Save
Application.Quit
End Sub

/Roger
 

Excel Facts

Which Excel functions can ignore hidden rows?
The SUBTOTAL and AGGREGATE functions ignore hidden rows. AGGREGATE can also exclude error cells and more.
Re: ComboBox: ListFillRange, Active WorkBook: CloseButt

Hi Roger,
To force the user to close with a button, what I have used is this:
Code:
Private Sub Workbook_BeforeClose(Cancel As Boolean)
If Worksheets("Sheet1").Range("A1").Value <> "Close" Then
Cancel = True
MsgBox " Please use the Exit button to close."
End If
End Sub
And then of course you need to have your command button enter "Close" into A1 of sheet1 at the beginning if its code.

This help?
Dan
 
Upvote 0
Re: ComboBox: ListFillRange, Active WorkBook: CloseButt

Oh yeah,
It dawned on me that you'll NOT want to make A1 say "Close" at the beginning of your code. You'll want to have it enter that after you save the workbook. (Otherwise this will only work for you the first time.)
Sorry, :oops:
Dan
 
Upvote 0

Forum statistics

Threads
1,214,905
Messages
6,122,175
Members
449,071
Latest member
cdnMech

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top