ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   1004 runtime error (https://www.excelbanter.com/excel-programming/367577-1004-runtime-error.html)

Waldyd

1004 runtime error
 
Hi...

I saved an Excel Application as Microsoft Excel Complement and when i
started the Application, the followin was prompt:

1004 runtime error
Error in 'Worksheets' method of '_Global' Object

Here is the code causing the error

Sub Auto_open()


'Modificacion de la GUI de Excel
'''''''''''''''''''''''''''''''''''''''''''''''''' '''''''

Application.DisplayStatusBar = False
Application.CommandBars("Standard").Visible = False
Application.CommandBars("Formatting").Visible = False
Application.CommandBars("Drawing").Visible = False
Application.DisplayFormulaBar = False


For i = 1 To Int(Worksheets.Count) 'This line is causing the error

Worksheets(i).Activate
With ActiveWindow
.DisplayGridlines = False
.DisplayHeadings = False
.DisplayHorizontalScrollBar = False
.DisplayVerticalScrollBar = False
.DisplayWorkbookTabs = False
End With

Next i

Sheets(1).Select
Range("A44").Select
ActiveWindow.ScrollRow = 1

a7n9[_4_]

1004 runtime error
 

Try giving explicit reference of the Workbook to the Worksheets
collection

Something like: Workbooks("1").Worksheets.Count or
Thisworkbook.Worksheets.Count


--
a7n9


------------------------------------------------------------------------
a7n9's Profile: http://www.excelforum.com/member.php...o&userid=32149
View this thread: http://www.excelforum.com/showthread...hreadid=562551



All times are GMT +1. The time now is 05:02 PM.

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