Results 1 to 3 of 3
  1. #1
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Cell Referencing (XP)

    I have just been looking at some code behind an Excel card game simulation where all cell references were in the form:

    [E1]=3, [H22]=65 etc which certainly simplifies the code. There was not a single instance of 'Range("E1").value' etc. Are there any drawbacks to using this method of cell referencing?

    Regards
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

  2. #2
    Plutonium Lounger
    Join Date
    Mar 2002
    Posts
    84,353
    Thanks
    0
    Thanked 29 Times in 29 Posts

    Re: Cell Referencing (XP)

    You can use [E1] and Range("E1") interchangeably, but there are a few things to watch for:
    1) If you define a constant, variable, procedure or function named E1, Excel will not interpret [E1] as a range any more, but as reference to that constant or ...
    2) The notation Range(...) allows you to use an expression, e.g.

    Dim n As Long
    n = ...
    Range("E" & n) = 37

    You cannot do that with the [E1] notation.

  3. #3
    4 Star Lounger
    Join Date
    Sep 2002
    Location
    Stafford, Staffordshire, England
    Posts
    585
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: Cell Referencing (XP)

    Thanks for that, Hans.
    <font color=blue><font face="Script MT Bold"><big>Rob</big></font face=script></font color=blue>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •