View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Dick Kusleika[_3_] Dick Kusleika[_3_] is offline
external usenet poster
 
Posts: 599
Default a reminder, please - Range w/out qualified reference

Joe

Also note that the default "roll-up" object is different in class modules
(e.g. ThisWorkbook, Sheet1, etc.) If you use an unqualified 'Range' in, for
example, the Worksheet_Change event for Sheet1, then it will roll-up to the
object represented by that class, namely Sheet1. Similarly, if you use
'Sheets("Sheet1")' in the Workbook_Open event (in the ThisWorkbook class
module), you will be referencing Sheet1 in ThisWorkbook, not in the
ActiveWorkbook. In standard modules, the roll-up object for an unqualified
Range is the activesheet and for an unqualified Sheets(x) is the Active
Workbook.

--
Dick Kusleika
MVP - Excel
www.dicks-clicks.com
Post all replies to the newsgroup.


"Jean-Yves" wrote in message
...
Hi Joe,

Not always. If rangeName refers to a range NAME, it can be on another
worksheet.
If it is only a string variable which represent a range address, then we
assume it is in the
the active sheet.
Regards,

Jean-Yves


"Joe" wrote in message
...
If I see the following in a line of code:

Range(rangeName) = Int(iValue)

Can I assume that this refers to a range in the activesheet?

Joe