Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Option Explicit Error

Why do I get an error message on "Option Explicit"?

Private Sub CommandButton34_Click()
Option Explicit
Sub testme01()

Dim iRow As Long
Dim HowMany As Long

HowMany = 20

With ActiveSheet
For iRow = 52 To (32 * HowMany - 1) + 52 Step 32
If IsNumeric(.Cells(iRow + 3, "I").Value) Then
If .Cells(iRow + 3, "I").Value 0 Then
.Cells(iRow, "A").Resize(16, 9).PrintPreview
'.printout when you're done checking
Exit For
End If
End If
Next iRow
End With

Range("A1").Select
End Sub

Thank You,
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 74
Default Option Explicit Error

Bob,

Try moving Option Explicit outside the subroutine.

Option Explicit


Private Sub CommandButton34_Click()
Sub testme01()

Dim iRow As Long
Dim HowMany As Long

HowMany = 20

yadda, yadda, yadda,

Regards,
Kevin

"Bob" wrote in message
...
Why do I get an error message on "Option Explicit"?

Private Sub CommandButton34_Click()
Option Explicit
Sub testme01()

Dim iRow As Long
Dim HowMany As Long

HowMany = 20

With ActiveSheet
For iRow = 52 To (32 * HowMany - 1) + 52 Step 32
If IsNumeric(.Cells(iRow + 3, "I").Value) Then
If .Cells(iRow + 3, "I").Value 0 Then
.Cells(iRow, "A").Resize(16, 9).PrintPreview
'.printout when you're done checking
Exit For
End If
End If
Next iRow
End With

Range("A1").Select
End Sub

Thank You,



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 48
Default Option Explicit Error

I think you should remove these two lines:

Option Explicit
Sub testme01()

These look useless.


----- Bob wrote: -----

Why do I get an error message on "Option Explicit"?

Private Sub CommandButton34_Click()
Option Explicit
Sub testme01()

Dim iRow As Long
Dim HowMany As Long

HowMany = 20

With ActiveSheet
For iRow = 52 To (32 * HowMany - 1) + 52 Step 32
If IsNumeric(.Cells(iRow + 3, "I").Value) Then
If .Cells(iRow + 3, "I").Value 0 Then
.Cells(iRow, "A").Resize(16, 9).PrintPreview
'.printout when you're done checking
Exit For
End If
End If
Next iRow
End With

Range("A1").Select
End Sub

Thank You,
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 391
Default Option Explicit Error

Option Explicit should be the very first line of the code
sheet.

Tip: Under Tools/Options in the Editor tab, make sure
that the checkbox for 'Require Variable Declaration' is
checked...this will add Option Explicit automatically.

Tip: Add
Option Private Module
This means that PUBLIC procedures will not be visible in
Excel's Macro list, but will be available to other modules

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
Why do I get an error message on "Option Explicit"?

Private Sub CommandButton34_Click()
Option Explicit
Sub testme01()

Dim iRow As Long
Dim HowMany As Long

HowMany = 20

With ActiveSheet
For iRow = 52 To (32 * HowMany - 1) + 52 Step 32
If IsNumeric(.Cells(iRow + 3, "I").Value)

Then
If .Cells(iRow + 3, "I").Value 0 Then
.Cells(iRow, "A").Resize(16,

9).PrintPreview
'.printout when you're

done checking
Exit For
End If
End If
Next iRow
End With

Range("A1").Select
End Sub

Thank You,
.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Option Explicit [email protected] Excel Discussion (Misc queries) 5 April 30th 08 11:19 PM
option explicit Dave F Excel Discussion (Misc queries) 2 September 5th 06 02:46 PM
Implied Option Explicit in XP?? Trip[_2_] Excel Programming 3 November 13th 03 12:24 AM
Urgent: Object Explicit Error Jonathan Lowe Excel Programming 2 October 20th 03 11:14 PM
Option Explicit and Arrays Harlan Grove[_5_] Excel Programming 3 July 22nd 03 12:51 AM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"