R
R Ormerod
I have 16 x combo boxes set up in a cover worksheet with List Fill Ranges
determining the values in the drop-down list and Linked Cells where the
results of the selection are sent in 2 x other worksheets respectively.
When I attempt to Close or Save the workbook with the active worksheet being
either of those other than the cover, the Run Time Error 1004: Select method
of Range class failed occurs.
Debug always selects the Private Sub ComboBox_Change() code for one
particular combo box:
Sheets("Cover").Range("C13").Select
This is identical to the code for all the other boxes (apart from the cell
reference), the idea being that as soon as a selection has been made the
combo box contents are deselected and the cursor moves to the cell below the
box.
The following code was recommended by this forum which resolved the problem:
Application.Goto Sheets("Cover").Range("C13"), Scroll:=False
However, this new code means that the contents of this combo box after
drop-down selection are still highlighted and can be edited. I changed the
combo box Style to 2-fmStyleDropDownList, but this still means that any other
value in the list can be selected (e.g. by using the arrow keys).
Another problem has now occurred when I attempt to Save As. The run time
error as above occurs, but debug now highlights the Private Sub code for all
of the other combo boxes in turn which still have the original code.
I can change the code for all the other boxes to overcome this, but this
raises two questions:
1) How can I add to the new code to deselect the combo box contents?
2) How could Save As cause the run time error in all the other boxes but
Close or Save only in one?
determining the values in the drop-down list and Linked Cells where the
results of the selection are sent in 2 x other worksheets respectively.
When I attempt to Close or Save the workbook with the active worksheet being
either of those other than the cover, the Run Time Error 1004: Select method
of Range class failed occurs.
Debug always selects the Private Sub ComboBox_Change() code for one
particular combo box:
Sheets("Cover").Range("C13").Select
This is identical to the code for all the other boxes (apart from the cell
reference), the idea being that as soon as a selection has been made the
combo box contents are deselected and the cursor moves to the cell below the
box.
The following code was recommended by this forum which resolved the problem:
Application.Goto Sheets("Cover").Range("C13"), Scroll:=False
However, this new code means that the contents of this combo box after
drop-down selection are still highlighted and can be edited. I changed the
combo box Style to 2-fmStyleDropDownList, but this still means that any other
value in the list can be selected (e.g. by using the arrow keys).
Another problem has now occurred when I attempt to Save As. The run time
error as above occurs, but debug now highlights the Private Sub code for all
of the other combo boxes in turn which still have the original code.
I can change the code for all the other boxes to overcome this, but this
raises two questions:
1) How can I add to the new code to deselect the combo box contents?
2) How could Save As cause the run time error in all the other boxes but
Close or Save only in one?