Results 1 to 10 of 117

Thread: Tests and Notes on Range objects in Excel Cell

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #32
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,452
    Rep Power
    10

    RangeObjectDefaultPropertiesCells

    RangeObjectDefaultProperties(Methods?)SingleCells*

    Single cell range objects and the .Value story
    I am thinking that there may be some over simplification on the so called .Value Property, and this typical Pseudo code line, needs some re thinking
    _________________ Range2.Value = Range1.Value
    (*There could be distinct differences with the multi cell case, so I will consider that case separately)

    LHS
    _________________ Range2.Value = Range1.Value

    My feeling is that the LHS can either be written as Range2 = or Range2.Value. So these are the same
    _________________ Range2 _ = Range1.Value
    _________________ Range2.Value = Range1.Value
    .Value in such a situation is a perhaps poorly / vaguely/ imprecisely / incompletely defined as “Property”, (or by Default Property for the case that you miss it out) . This definition is perhaps some attempt to make it fit with Object Orientated Programing, but it’s a bit more vague/ imprecise/ not really so well fitting as things might more often be on average.
    It is probably a bit better, IMO, to think of it (it being the LHS whether Range2 = or Range2.Value ) as writing text or numbers into the cell, specifically the numbers or text that is related to the RHS
    Saying the same thing a bit differently, the LHS ( if the LHS is Range2 = or Range2.Value ) will take what’s on the RHS and put the associated text or number related to what is on the RHS

    The .Value thing/ idea/Property/Default Property concept, call it what you like, but whatever it is on the LHS , it has something to do with writing in the cell something about what is on the RHS. I guess "putting in a value" and "writing something in" is saying something similar, so that is how the vague concept comes about of “Property”, or Default Value Property of the Range2 object
    It’s debatable perhaps if the LHS of Range2 = or Range2.Value is a method, as it looks at what is on the RHS and gives some written attribute about it.

    I think from now on, or for now from now, based on some of these recent investigations, I might prefer to use
    Let Range2 =
    , instead of
    Range2.Value = or Let Range2.Value =
    This helps me to remember that I am writing in numbers or text, related to what is on the RHS, probably either
    , _ something from here:
    https://i.postimg.cc/ryGZ6jb6/Writte...erty-Value.jpg
    Written Property Value.JPG
    , or
    , _ perhaps something from here.
    https://i.postimg.cc/k5N8264j/Writte...from-Value.jpg


    Which of those will vary depending of the RHS, where it seems the exact syntax used does make a difference …….
    , that will be considered in more detail under the RHS heading below, first a couple of side issues

    ……."values" The word values often refers generally to things in the cell numbers text and the specific formatting only that can be done with just numbers and text. It all is done by putting/ wring in a cell, and so it follows, or makes some sense/sensible correlation, that all these values, not just .Value can be used or not on the LHS and the effect is the same as having none of them. In other words, the following code lines all have the same effect in the Range2.Value = Range1.Value type code lines that we have been talking about
    Range2.Value =
    Range2 =
    Range2.FormulaR1C1Local =
    Range2.Formula =

    Perhaps anytime we use any of these sort of Properties, we default to just Range2 =

    …….Rem 1 Variable type considerations
    It is not directly relevant to our Range2.Value = Range1.Value, considerations but indirectly when experimenting can be worth being aware of. If the LHS is a Variable, then things will not necessarily follow a similar, "Pattern", (set of rules, occurrences, or what ever you want to call it), to what we now consider , as we consider the RHS ………


    RHS
    I am thinking that possibly we ought to consider these 2 things as different
    _________________ Range2.Value = Range1.Value
    _________________ Range2.Value = Range1
    The first one, ________________ Range2.Value = Range1.Value , will work similarly to something like ____ = Range1.Interior.Color , and in conjunction with the LHS as so far discussed, (Range2 = or Range2.Value) , it will give some number or text attribute, specifically for the thing asked for, in these two cases .Value or .Interior.Color
    It won’t make any difference whether the LHS is Range2 = or Range2.Value, (as far as I can tell, it never makes a difference), the result will be the same , a number or text will be written in the cell, and if a text is written in the cell, which looks like a number, even if it is from a cell exhibiting the Number held as text thing , then we will get a number. In other words, if I have It seems to be doing similar what we as a human would, writing in the cell. Excel will then decide if it’s a number, text, or whatever. A text looking like a number, will be displayed as a number and we won’t get the Number held as text thing showing. This is important so just to say that again slightly differently: Using ____ = __.Value on the RHS to bring the value of cell exhibiting the Number held as text thing into another cell will not result in that other cell exhibiting the Number held as text thing : that warning thing will not appear in the other cell

    Now it gets interesting, for the case of not including the ____ = __.Value on the RHS
    It’s often said that in this situation Range2.Value = Range1 the default property, .Value will be used. But that does not seem to be quite right. I see it perfume a bit differently sometimes.
    It may be only subtly different and I am not sure exactly what is going on, but a guess is that it is initially taking the range object, and then taking something from it. It then puts that in the cell, but in some other way.
    Or , maybe it is taking this thing: https://i.postimg.cc/ryGZ6jb6/Writte...erty-Value.jpg
    Written Property Value.JPG
    In that last screen shot, for cell C69, where we have a number, showing as a number , we see 44
    In this next screenshot, for cell A69, where we have a number but the cell is displaying the Number stored as text Thing , we see there " 44 "
    https://i.postimg.cc/Xq1HsdJL/Cell-A69.jpg
    Cell A69.JPG
    This might be the "thing" that we sometimes get for various objects, when we assign that object to a string type variable. For some reason it works then differently, rather than "writing" into the cell in similar way that we might do, it does it in some other way such that the actual text is put in, and so we appear to get the Number stored as text Thing warning thing preserved.


    Some coding in the next posts demonstrate some of the above
    Last edited by DocAElstein; 08-06-2023 at 11:20 AM.

Similar Threads

  1. Replies: 114
    Last Post: 03-04-2024, 02:39 PM
  2. Tests and Notes on Range Referrencing
    By DocAElstein in forum Test Area
    Replies: 70
    Last Post: 02-20-2024, 01:54 AM
  3. Tests and Notes for EMail Threads
    By DocAElstein in forum Test Area
    Replies: 29
    Last Post: 11-15-2022, 04:39 PM
  4. Some Date Notes and Tests
    By DocAElstein in forum Test Area
    Replies: 0
    Last Post: 11-23-2021, 10:40 PM
  5. Notes tests. Excel VBA Folder File Search
    By DocAElstein in forum Test Area
    Replies: 39
    Last Post: 03-20-2018, 04:09 PM

Posting Permissions

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