ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Excel VBA error - Select method of Range class failed (https://www.excelbanter.com/excel-programming/393253-excel-vba-error-select-method-range-class-failed.html)

R Ormerod

Excel VBA error - Select method of Range class failed
 
In a workbook with two worksheets, I receve this error message when closing
the file when the second worksheet is active, but not the first.

Debug points to code in a Private Sub relating to one (only) of eight combo
boxes in the first worksheet (which determine the contents of a selection of
cells in the second), as follows:

Private Sub ComboBox3_Change()

Range("A1").Select

This code is in located the worksheet, not the module.

I tried the following code to resolve the issue but no joy:

Sub Workbook_BeforeClose()

Sheets("Cover").Activate
Range("A1").Select

Both worksheets (apart from unlocked cells) and the workbook are protected.

Any ideas?

--
R Ormerod


All times are GMT +1. The time now is 01:42 PM.

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