a reminder, please - Range w/out qualified reference

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

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
 
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

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.
 
Back
Top