Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Workbook_Open Event
The follow code worked when I had it in a
CommandButton_Click Event (used that event for testing purposes). But when I transferred the code to the Workbook_Open Event, I receive a "Run-Time error '9': Subscript out of range" at "With ThisWorkbook... " Why?? TIA Mike Private Sub Workbook_Open() Dim numRows As Long 'Refresh data of Sheet2 Workbooks.Open Filename:="C:\CCF\Contracts1.xls" With ThisWorkbook.Worksheets("Sheet1") 'Determine number of rows numRows = Application.CountA(ActiveSheet.Range ("A:A")) ActiveSheet.Range("A1:AI" & numRows).Copy .Range ("Contracts!A1") End With ActiveWorkbook.Close cmbContracts.ListFillRange = "Contracts!A2:C" & numRows End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
workbook_Open event Procedure | Excel Discussion (Misc queries) | |||
workbook_Open event Procedure | Excel Discussion (Misc queries) | |||
Workbook_Open() Event | Excel Discussion (Misc queries) | |||
OnTime event not firing in Workbook_Open event procedure | Excel Programming | |||
Workbook_Open event not working | Excel Programming |