MrExcel Publishing
Your One Stop for Excel Tips & Solutions

Option Explicit


Posted by Duncan on May 01, 2001 4:40 AM

I have the following code in my macro

For Each sheet In Worksheets
sheet.calculate
Next sheet

This works fine without option explicit but with it doesn't know what sheet is - I obviously need to declare it as something - but what??
please could someone help
thanks
Duncan


Posted by Ivan Moala on May 01, 2001 6:04 AM

Duncan

Dim Sheet as Worksheet
eg

Sub test()
Dim Sheet As Worksheet

For Each Sheet In Worksheets
Sheet.Calculate
Next Sheet
End Sub


Ivan