Article ID: 151097
Article Last Modified on 10/11/2006
Option Explicit
Option Explicit
Sub DisplaysError()
Dim ws as Worksheet
Dim r as Range
Set ws = Sheets!Sheet1
Set r = ws.range!("A1:A6")
End Sub
The following syntax does not produce an error message:
Option Explicit
Sub DoesNotDisplayError()
Dim r as Range
Set r = Sheets!Sheet1.Range!("A1:A6")
End Sub
Using the exclamation point after Range when setting the range variable off
of a worksheet variable properly produces an error message. Using the
exclamation point when the range variable is set off of a worksheet
reference does not produce an error message.
Additional query words: 5.00 XL
Keywords: KB151097