PDA

View Full Version : Tests and Notes on Range objects in Excel Cell



DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg (https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1 (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg)
https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg (https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg)
https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg (https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg)
https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg (https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg.9C-br0lEl8V9xI0_6pCaR9 (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg.9C-br0lEl8V9xI0_6pCaR9)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg.9bl7m03Onql9xI-ar3Z0ME (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg.9bl7m03Onql9xI-ar3Z0ME)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg.9gdrYDocLIm9xI-2ZpVF-q (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg.9gdrYDocLIm9xI-2ZpVF-q)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg.9id_Q3FO8Lp9xHyeYSuv 1I (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg.9id_Q3FO8Lp9xHyeYSuv 1I)
https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3 (https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M)
ttps://www.youtube.com/watch?v=LP9fz2DCMBE (ttps://www.youtube.com/watch?v=LP9fz2DCMBE)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8 (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8)
ttps://www.youtube.com/watch?v=bFxnXH4-L1A (ttps://www.youtube.com/watch?v=bFxnXH4-L1A)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg)
ttps://www.youtube.com/watch?v=GqzeFYWjTxI (ttps://www.youtube.com/watch?v=GqzeFYWjTxI)
https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg (https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3 (https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M)
ttps://www.youtube.com/watch?v=LP9fz2DCMBE (ttps://www.youtube.com/watch?v=LP9fz2DCMBE)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8 (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8)
ttps://www.youtube.com/watch?v=bFxnXH4-L1A (ttps://www.youtube.com/watch?v=bFxnXH4-L1A)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg)
ttps://www.youtube.com/watch?v=GqzeFYWjTxI (ttps://www.youtube.com/watch?v=GqzeFYWjTxI)
https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg (https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg (https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1 (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg)
https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg (https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg)
https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg (https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg)
https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg (https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg.9C-br0lEl8V9xI0_6pCaR9 (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg.9C-br0lEl8V9xI0_6pCaR9)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg.9bl7m03Onql9xI-ar3Z0ME (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg.9bl7m03Onql9xI-ar3Z0ME)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg.9gdrYDocLIm9xI-2ZpVF-q (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg.9gdrYDocLIm9xI-2ZpVF-q)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg.9id_Q3FO8Lp9xHyeYSuv 1I (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg.9id_Q3FO8Lp9xHyeYSuv 1I)
https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3 (https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M)
ttps://www.youtube.com/watch?v=LP9fz2DCMBE (ttps://www.youtube.com/watch?v=LP9fz2DCMBE)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8 (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8)
ttps://www.youtube.com/watch?v=bFxnXH4-L1A (ttps://www.youtube.com/watch?v=bFxnXH4-L1A)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg)
ttps://www.youtube.com/watch?v=GqzeFYWjTxI (ttps://www.youtube.com/watch?v=GqzeFYWjTxI)
https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg (https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Nov 11, 2014
https://www.mrexcel.com/board/threads/range-equivalent-to-range-value-sometimes-range-range-value-anomaly.817446/#post-3990978

Hi,
. Getting very frustrated as a VBA Beginner on some fundamental stuff. Please Help with a simple to understand explanation.
. The problem is An anomaly I found by chance, that is to say through occasional Typos in various codes I had written which assigned range values to a cell or range of cells in a column…
. As I investigated I hit on some fundamental curiosities, the answer to which I could not find by googling or Books etc. Therefore I ask the experts here for help:
.
. A simple case to demonstrate:
. Assume in Column A I have some arbitrary values and I copy them into Column C. For the purposes of this experiment I am using Range to do this

. For one row any of the following 4 code lines work:


Sub RangeRangeDotValueAnomalySingleCells()
Let Range("C1").Value = Range("A1").Value 'Works: returns value in cell A1 in Cell C1
Let Range("C1") = Range("A1") 'Works: returns value in cell A1 in Cell C1
Let Range("C1") = Range("A1").Value 'Works: returns value in cell A1 in Cell C1
Let Range("C1").Value = Range("A1") 'Works: returns value in cell A1 in Cell C1
End Sub

. The first line working ties up with everything one learns and sees. That the second line works I am not too sure about. The third and forth lines I expected to error with a type mismatch, that is to say comparing an Object with a Variable

………………………

Taking the experiment one stage further to consider multiple cell Ranges the results puzzle me even further.
. For Rows 3 to 10 the corresponding 4 code lines give the results indicated in the green comments alongside each line


Sub RangeRangeDotValueAnomalyMultipleCells()
Dim rngA As Range, rngC As Range
Set rngA = Range("A3:A10")
Set rngC = Range("C3:C10")
Let rngC.Value = rngA.Value 'Works! Returns values form First column in Third column
Let rngC = rngA ' Returns empty column in Third column
Let rngC = rngA.Value 'Works! Returns values form First column In Third Column
Let rngC.Value = rngA ' Returns empty column in Third column
End Sub

I realize on the face of it this seems a somewhat simple question, but a full understanding could be very helpful in some more difficult anomalies I have been faced with in codes evaluating various ranges.
. I very much appreciate any helpful explanations easy for a VBA novice to understand.
Alan.

(P.s. I realize that Let is unnecessary, it is just a throw back to 25 years ago – the last time I did any programming and as it “Lets” me do it I find it helpful as a beginner in VBA with distinguishing the 3 cases whereby Let or Set or nothing is allowed or required!)



' Nov 13, 2014 https://www.mrexcel.com/board/threads/dimension-array-range-anomaly.817965/

Sub RangeArrayDirect()
'Dim RangeArray() As Variant '. As you can see I have “Commented out” the first Dim statement as if I use this instead I get a Type Mismatch error ( I prefer to use such a Dim statement to be as explicit as possible in dimensioning which I believe is good practice.)
Dim RangeArray As Variant
Let RangeArray = Worksheets("RangeValuevalues").Range(Cells(2, 2), Cells(3, 3)) '
' Watch : + : Worksheets("RangeValuevalues").Range(Cells(2, 2), Cells(3, 3)) : : Variant/Object/Range : Tabelle6.RangeArrayDirect
End Sub
'. I can overcome the problem by adding an in between step (which is probably good practice anyway) as follows:

Sub RangeArrayIndirect()
Dim RangeArray() As Variant
Dim rngRangeArray As Range
Set rngRangeArray = Worksheets("RangeValuevalues").Range(Cells(2, 2), Cells(3, 3))
Let RangeArray = rngRangeArray ' Watch : + : rngRangeArray : : Range/Range : Tabelle6.RangeArrayIndirect
End Sub


Option Explicit
' https://www.mrexcel.com/board/threads/range-equivalent-to-range-value-sometimes-range-range-value-anomaly.817446/ https://fastexcel.wordpress.com/2017/03/13/excel-range-valuevaluetype-what-is-this-parameter/
' Nov 11, 2014
Sub RangeRangeDotValueAnomalySingleCells()
Let Range("C1").Value = Range("A1").Value 'Works: returns value in cell A1 in Cell C1
Let Range("C1") = Range("A1") 'Works: returns value in cell A1 in Cell C1
Let Range("C1") = Range("A1").Value 'Works: returns value in cell A1 in Cell C1
Let Range("C1").Value = Range("A1") 'Works: returns value in cell A1 in Cell C1

' Let Range("C1").Value = Range("A1").Range ' Complie error, argument not optional
End Sub
Sub RangeRangeDotValueAnomalyMultipleCells()
Dim rngA As Range, rngC As Range
Set rngA = Range("A3:A10")
Set rngC = Range("C3:C10") ' .Range ' If you want to explicitly tell Excel to use the range object, then you can force it. ' Complie error, argument not optional
Let rngC.Value = rngA.Value 'Works! Returns values form First column in Third column
Let rngC = rngA ' Returns empty column in Third column
Let rngC = rngA.Value 'Works! Returns values form First column In Third Column
Let rngC.Value = rngA ' Returns empty column in Third column
End Sub
' There is no hard documentation that I am aware of that will tell you why some of those don't work. Suffice to say, when you mean .Value, write .Value. Never use implicit defaults because it will bite you when you don't expect it if you do. As another example
Sub huh()
Dim vData()
Dim Ws As Worksheet
Set Ws = ActiveSheet
vData() = Range("A1:A10").Value ' works Watch : + : Range("A1:A10").Value : : Variant/Variant(1 to 10, 1 to 1) : Tabelle6.huh
vData() = ActiveSheet.Range("A1:A10").Value ' works Watch : + : ActiveSheet.Range("A1:A10").Value : : Variant/Variant(1 to 10, 1 to 1) : Tabelle6.huh
vData() = Ws.Range("A1:A10").Value ' works Watch : + : ActiveSheet.Range("A1:A10").Value : : Variant/Variant(1 to 10, 1 to 1) : Tabelle6.huh

vData() = Range("A1:A10") ' works Watch : + : Range("A1:A10") : : Object/Range : Tabelle6.huh
' Watch : - : vData() : : Variant/Variant(1 to 10, 1 to 1) : Tabelle6.huh
vData() = ActiveSheet.Range("A1:A10") ' gives Type Mismatch error
' Watch : + : ActiveSheet.Range("A1:A10") : : Variant/Object/Range : Tabelle6.huh
vData() = Ws.Range("A1:A10") ' works Watch : + : ws.Range("A1:A10") : : Object/Range : Tabelle6.huh
End Sub
' https://www.mrexcel.com/board/threads/range-equivalent-to-range-value-sometimes-range-range-value-anomaly.817446/#post-3991004
' The only real difference between the line that fails and the one that follows is that
' ActiveSheet returns a generic Object so you are effectively late bound.
'From the VBA language spec, this I think is the most relevant section:
' 5.6.2.3 Default Member Recursion Limits
' Evaluation of an object whose default Property Get or default function returns another object
' can lead to a recursive evaluation process if the returned object has a further default member.
' Recursion through this chain of default members may be implicit if evaluating to a simple data value
' and each default member has an empty parameter list
' , or explicit if index expressions are specified that specifically parameterize each default member.
' An implementation may define limits on when such a recursive default member evaluation is valid.
' The limits may depend on factors such as the depth of the recursion
' , implicit vs. explicit specification of empty argument lists
' , whether members return specific classes vs. returning Object or Variant
' , whether the default members are functions vs. Property Gets
' , and whether the expression occurs on the left-hand-side of an assignment.
' The implementation may determine such an evaluation to be invalid statically
' or may raise error 9 (Subscript out of range) or 13 (Type mismatch) during evaluation at runtime.
'
'
'_


' Nov 13, 2014 https://www.mrexcel.com/board/threads/dimension-array-range-anomaly.817965/
Sub RangeArrayDirect()
'Dim RangeArray() As Variant '. As you can see I have “Commented out” the first Dim statement as if I use this instead I get a Type Mismatch error ( I prefer to use such a Dim statement to be as explicit as possible in dimensioning which I believe is good practice.)
Dim RangeArray As Variant
Let RangeArray = Worksheets("RangeValuevalues").Range(Cells(2, 2), Cells(3, 3)) '
' Watch : + : Worksheets("RangeValuevalues").Range(Cells(2, 2), Cells(3, 3)) : : Variant/Object/Range : Tabelle6.RangeArrayDirect
End Sub
'. I can overcome the problem by adding an in between step (which is probably good practice anyway) as follows:
Sub RangeArrayIndirect()
Dim RangeArray() As Variant
Dim rngRangeArray As Range
Set rngRangeArray = Worksheets("RangeValuevalues").Range(Cells(2, 2), Cells(3, 3))
' Watch : + : Worksheets("RangeValuevalues").Range(Cells(2, 2), Cells(3, 3)) : : Variant/Object/Range : Tabelle6.RangeArrayIndirect
Let RangeArray() = rngRangeArray ' Watch : + : rngRangeArray : : Range/Range : Tabelle6.RangeArrayIndirect
End Sub

DocAElstein
08-24-2019, 01:01 PM
This Post is #21995 #12
https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page2#Post21995



Right Hand Side Range Range Value values
Range= equivalent to Range.Value= only sometimes. Range Range.Value Anomaly
Question from the web (https://www.mrexcel.com/board/ ( forum) ) (https://www.mrexcel.com/board/threads/range-equivalent-to-range-value-sometimes-range-range-value-anomaly.817446/)
https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page2#Post21994
That was a good question, Alan.

Answer
I want to limit the discussion mainly to a general ranges code lines of these pseudo form
Let Range2.Value = Range1.Value
Let Range2 = Range1.Value
Let Range2.Value = Range1
Let Range2 = Range1
, which ijn words is something like,
Writing in Cells = Reading text and/ or numbers
LHS
Also to limit the discussion here, I want to say, and please Let me, for now that the LHS variations all do the same, which is Writing in a Cells, and consequence of that is that anything to do with number values, text values in most## cases doing something very similar to how us Human’s would physically write things in cells. A consequence of that is that whether we have a formula or not is determined by whether the first character is an = , and this means that all these sort of "things" do the same. (I would tend to call these "things" values )
FormulaR1C1Local
FormulaR1C1
FormulaR1C1Local
Value2
Value(RangeValueDataType:=xlRangeValueDefault)
Formula
(These things are handled different to other things such that we can write in a single value or all values in a multi cell rectangular range of values all in one go)
So I would like to take the liberty of leaving the LHS as this
Let Range2 =

A further simplification for the sake of clarity that I would like to make is to stay with ranges / cells, on the LHS and not get into variables too much there. Such considerations lead to further issues and complications such as whether things coerce or Excel is just written to do things in certain conditions, and possible Default Member Recursion Limits, and discussions of whether entrails should be pulled out of the LHS when sacrificing a virgin…etc, etc. I want to avoid that.


RHS
This is what it is all about, here.
I think it is an over simplification, and arguably wrong to say that the .Value is generally a Property and the default property of a range object.
For one thing the LHS writing .Value and RHS read .Value seem to be different/ only loosely related
We already discussed briefly the LHS, and we might at a stretch of the imagination be able to say that default property is value. I might argue that it is the other way around. Something like, on the writing LHS, the default of these values things,
Range.FormulaR1C1Local =
Range.FormulaR1C1 =
Range.FormulaR1C1Local =
Range.Value2 =
Range.Value(RangeValueDataType:=xlRangeValueDefaul t) =
Range.Formula =
, is
Range =
I can’t even see an Range.Value Property there. I can see a Range.Value(RangeValueDataType:=xl________) thing. That looks like a method to me. It acts like one as well, doing quite different things depending on the argument you give it.
Anyway back to the RHS
It does not appear to me to have a default property. You are reading stuff, and you had better be sure you tell the Range1 object what you want, or else people like RoryA will start confusing you with rubbish like Default Member Recursion Limits (https://www.mrexcel.com/board/threads/dimension-array-range-anomaly.817965/#post-3993589) and god knows what else he either dreamt up, doesn’t understand or can’t or won’t explain.
Now if you don’t use something such as
.Value( RangeValueDataType:=xl________ )
( , or
.Value
, if you only feel like being semi – Explicit ),
, then something else happens….
I still don’t know for sure what happens, but a couple of guesses…
_ The Range1 if used on the RHS is an object. Some objects have a "value" that is a text and/or number string that is returned if you try to assign that object somewhere expecting to have some text and/or number string given to it. This "value" might be that thing you see, for example, in the Watch Window.
https://i.postimg.cc/y83k0dH3/range-object-value-in-Immediate-Window.jpg
https://i.postimg.cc/YvkrHtjt/range-object-value-in-Immediate-Window.jpg (https://postimg.cc/YvkrHtjt)
https://i.postimg.cc/y83k0dH3/range-object-value-in-Immediate-Window.jpg (https://postimages.org/)

Example macro in next post:
Here a brief description of what is going on in it
In '0a) I have found some ways empirically to get that Number held as Text thing (https://i.postimg.cc/CK1bnk7G/Number-held-as-Text-thing.jpg) . The thing that they have in common is putting an element of an array in a cell ( which we can’t manually do ) , and that element must be of a string type. As a Layman, I am thinking a couple of things
_ that low level computer stuff is all about arrays of strings. I am thinking that concepts of single values, variables and the such is high level stuff that helps us Humans to interface with computers, which is what spreadsheets are about: Tables and boxes with things in them.
_ once in a while, deliberately or by accident, perhaps often deliberately for efficiency, some processes by pass some of the high level Excel stuff which results in a number not getting in a spreadsheet as a number, but as a text that looks like one. For a lot of Excel and VBA stuff that is less important since things are often obliging, as a high level thing like Excel arguably should be. So often numbers held as text is handled as if they were normal numbers. But because we can use stuff external to Excel through VBA, some of which can be more intermediate level computer stuff, Microsoft give us an indication of when a number is held in the more low level string form, as in some things you could get problems such as type mismatch, as more intermediate level stuff may not have that extra wiring to convert/ coerce that VBA does.

In '0b) , for comparison, I believe VBA may be doing something very similar to what we can do manually: It is putting a number in a cell. Excel handles it, as it does, when we do it, and even of you are pretty sure it is a string, you won’t get the Number held as Text thing (https://i.postimg.cc/CK1bnk7G/Number-held-as-Text-thing.jpg)
'0c) demonstrates that putting an array generally into a cell, won’t necessarily get us that Number held as Text thing (https://i.postimg.cc/CK1bnk7G/Number-held-as-Text-thing.jpg) .

Rem 1 This is the Answer, at least as far as I have got. Some objects, when assigned to somewhere or assigned to a variable, other than an Object variable, give a string. It might be this thing, it might not.
https://i.postimg.cc/y83k0dH3/range-object-value-in-Immediate-Window.jpg
https://i.postimg.cc/YvkrHtjt/range-object-value-in-Immediate-Window.jpg (https://postimg.cc/YvkrHtjt)
https://i.postimg.cc/y83k0dH3/range-object-value-in-Immediate-Window.jpg (https://postimages.org/)

One thing that supports the idea is that if we repeat the experiment with a multi cell range object we get nothing in the cell and see nothing in the value place in the Immediate Window
https://i.postimg.cc/BvBQ2KRn/Multi-cell-range-object-value-in-Immediate-Window.jpg
https://i.postimg.cc/VS588dYx/Multi-cell-range-object-value-in-Immediate-Window.jpg (https://postimg.cc/VS588dYx)
https://i.postimg.cc/BvBQ2KRn/Multi-cell-range-object-value-in-Immediate-Window.jpg (https://postimages.org/)

That perhaps makes some sense, as it could be impractical to get lots of values there. Maybe never the less they are there , which might lend some tail shirt sense to it being held in an array, of string types, although then that contradicts the fact that other objects have a string value there, but that does not appear to get put n with a warning of the Number held as Text thing (https://i.postimg.cc/CK1bnk7G/Number-held-as-Text-thing.jpg)
So I am not much further with this Answer

Rem 2
For the case of a formula, Excel takes a similar alignment convention, but there in not that Number held as Text warning thing (https://i.postimg.cc/CK1bnk7G/Number-held-as-Text-thing.jpg). Possibly that could be because in most cases a formula would be more complicated and the result would be less ambiguous.
But, the very last code line suggests that Excel is still knowing if it has a number stored as text, and will once again let you know at least from if you do the stuff from Rem 1

DocAElstein
08-24-2019, 01:01 PM
' https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page2#Post21995 #12
Sub RangeOnlyRHS()
Rem 0 test data
Dim Ws As Worksheet
Set Ws = ThisWorkbook.Worksheets("RangeValuevalues")
Ws.Range("A1:D5").Clear
'0a) This puts an array into a cell. VBA can do this. We cant
Let Ws.Range("A1") = Split("44") ' This puts a 1 element string array in, which causes the Number held as Text thing https://i.postimg.cc/CK1bnk7G/Number-held-as-Text-thing.jpg
' Watch : - : Split("44") : : Variant/String(0 to 0) : Tabelle6.RangeOnlyRHS
' : Split("44")(0) : "44" : String : Tabelle6.RangeOnlyRHS
Let Ws.Range("A1") = Split("44 55") ' This does the same thing, it puts the two element array in, (but we will only see the first value as we are just filling in the first cell
' Watch : + : Split("44 55") : : Variant/String(0 to 1) : Tabelle6.RangeOnlyRHS
' : Split("44 55")(0) : "44" : String : Tabelle6.RangeOnlyRHS
' : Split("44 55")(1) : "55" : String : Tabelle6.RangeOnlyRHS
Dim StrS(0 To 0) As String
Let StrS(0) = "44"
Let Ws.Range("A1") = StrS()
' Watch : + : StrS() : : String(0 to 0) : Tabelle6.RangeOnlyRHS
' : StrS()(0) : "44" : String : Tabelle6.RangeOnlyRHS

'0b) For comparison, VBA is putting a single string value into a cell. We can also do that. When this happens I think Excel decides what the thing is, a number or text, so if it looks like a number, then it will make it a number
Let Ws.Range("B1") = "44"
Let Ws.Range("B1") = Split("44")(0) '
Let Ws.Range("B1") = Split("44 55")(0)
Let Ws.Range("B1") = StrS()(0)
'0c) Putting an array generally into a cell will not necerssarily get you that Number held as Text thing
Dim VarVals() As Variant: Let VarVals() = Ws.Range("A1:B1") ' ( When assigning to a variable, other than a Range object, Excel probably has a different set of rules, which some people might regard as coercing to suit the variable )
' Watch : + : VarVals() : : Variant/Variant(1 to 1, 1 to 2) : Tabelle6.RangeOnlyRHS
' + : VarVals()(1) : : Variant(1 to 2) : Tabelle6.RangeOnlyRHS
' : VarVals()(1,1) : "44" : Variant/String : Tabelle6.RangeOnlyRHS
' : VarVals()(1,2) : 44 : Variant/Double : Tabelle6.RangeOnlyRHS
Let Ws.Range("B1") = VarVals()
Rem 1 ' I am not fully sure what is going on here, but I might be returning this https://i.postimg.cc/y83k0dH3/range-object-value-in-Immediate-Window.jpg (https://postimages.org/) https://i.postimg.cc/y83k0dH3/range-object-value-in-Immediate-Window.jpg
Let Ws.Range("A2") = Ws.Evaluate("=IF(1=1,A1)") ' Watch : + : Ws.Evaluate("=IF(1=1,A1)") : "44" : Variant/Object/Range : Tabelle6.RangeOnlyRHS
Let Ws.Range("A2") = Ws.Range("=IF(1=1,A1)") ' Watch : + : Ws.Range("=IF(1=1,A1)") : "44" : Object/Range : Tabelle6.RangeOnlyRHS
Let Ws.Range("A2") = Ws.Range("A1") ' Watch : + : Ws.Range("A1") : "44" : Object/Range : Tabelle6.RangeOnlyRHS
Let Ws.Range("C2") = Ws.Range("A1:B2") ' This puts nothing in the cell , and there is nothing
' in the Immediate window value place either Watch : + : Ws.Range("A1:B2") : : Object/Range : Tabelle6.RangeOnlyRHS https://i.postimg.cc/BvBQ2KRn/Multi-cell-range-object-value-in-Immediate-Window.jpg
Rem 2
Let Ws.Range("A3") = "=A1" ' Put a formula into a cell with VBA or manually and I think maybe Excel decides what allignment to give you.
' Watch : + : Ws.Range("A3") : "44" : Object/Range : Tabelle6.RangeOnlyRHS
Let Ws.Range("B3") = "=B1" ' Watch : + : Ws.Range("B3") : 44 : Object/Range : Tabelle6.RangeOnlyRHS
Let Ws.Range("C4:D4").FormulaArray = "=A1:B1"
Let Ws.Range("A4:B4") = "=A1:B1" ' Works because of Interception and Implicit Intersection https://www.excelfox.com/forum/showthread.php/2145-Excel-VBA-Interception-and-Implicit-Intersection-and-VLookUp

Let Ws.Range("A5") = Ws.Range("A3") ' Watch : + : Ws.Range("A3") : "44" : Object/Range : Tabelle6.RangeOnlyRHS
End Sub

DocAElstein
08-24-2019, 01:01 PM
This post https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page2#post21997 Post #14

DocAElstein
08-24-2019, 01:01 PM
This post https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page2#post21998 Post #15

Some notes on support of these Threads and posts
https://eileenslounge.com/viewtopic.php?p=309151#p309151
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=22078&viewfull=1#post22078


We need to start again with the Evaluate(" "), that is to say the RHS _____ = Evaluate(" ") thing , and consider at the same time the RHS range thing _____ = Range(" ")

_ RHS _____ = Evaluate(" "), and RHS range object assignment thing _____ = Range(" ")
What is Evaluate(" "), with emphasis with what goes on in a spreadsheet cell
(Or what is going on in a cell after typing = ). I think maybe that when in a [cell] you write = , it can be considered as similar to this pseudo coding in VBA
[write in Cell] = Evaluate("What you put in the cell after the = ")
In simple terms, to a first approximation, Evaluate(" ") allows you to do in VBA wtihin the " " what you do after the = on a cell. (So perhaps its understandable that you can omit the = within the " " in Evaluate(" "), although it is accepted syntaxly: Perhaps it is then just redundant)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

This Post is #21995
https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page2#Post21995



Excel Functions ISTEXT and ISNUMBER (https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page10)
Explanations for my original Evaluate Range one liner until I realised I messed up (https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)/page58)
Starting again with hindsight. The new solution (https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)/page59)
Range Object Default Properties (Methods?) (https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page12)
Code line type Range2.Value = Range1.Value [color=white]Question from the web (https://www.excelfox.com/forum/showthread.php/2918-Right-Hand-Side-Range-Range-Value-values-Range-Range-Value-only-sometimes-Range-Range-Value-Anomaly?p=23192&viewfull=1#post23192)
New Solution(s) (https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=23187&viewfull=1#post23187)
Excel - alignment of numeric values in cells? https://eileenslounge.com/viewtopic.php?p=310023#p310023 https://eileenslounge.com/viewtopic.php?p=310024#p310024

DocAElstein
08-24-2019, 01:01 PM
Notes and tests in support of other Threads, mostly on things related to Range Referrencing.

To be added to and edited later :)

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
08-24-2019, 01:56 PM
I have a closed workbook, Closed.xlsm. ( It is the same folder as an open workbook, so I can get the path to it from a code line in the open workbook like ThisWorkbook.Path )

ExecuteExcel4Macro
_a) From that closed workbook (Closed.xlsm) I can get a value, using ExecuteExcel4Macro , from a single cell like this
somevalue = application.ExecuteExcel4Macro("'C\somepath\[Closed.xlsm]SomeSheet'!R1C1")
somevalue = application.ExecuteExcel4Macro("'" & ThisWorkbook.Path & "\[Closed.xlsm]SomeSheet'!R1C1")

_b) I cannot do something similar, using ExecuteExcel4Macro , to return a 2D array from Closed.xlsm like
some2Darray() =Application.ExecuteExcel4Macro("'C\path\[Closed.xlsm]somesheet'!R1C1:R5C2")
That last code line will not work. It will error!

However, I can do something similar to _a) and _b) using a similar approach with a simple closed workbook reference.

Closed Workbook Reference
_a) A simple formula , placed in an arbitrary spare cell , say the first, A1 , will return the value from a cell in a closed workbook
So for example, to return the value from the first cell in a closed workbook into the first cell of an open workbook, a simple code line like this can be used in the open workbook:
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet' R1C1"

This is what the closed workbook, Closed.xlsm, looks like
Closed_xlsm.JPG : https://imgur.com/CBbun1h
2370
If Closed.xlsm is closed and in the same folder as another workbook, macro.xlsm, then either of the following simple code lines in the following macro will return me the value from the first cell in the closed workbook, into the first cell in macro.xlsm

So after running the simple macro I will get this:
ClosedRefInCellA1.jpg : https://imgur.com/6N25bDe
2371


'
' https://www.excelforum.com/excel-programming-vba-macros/1286750-getting-2d-array-from-a-closed-workbook-using-executeexcel4macro.html
Sub Testie()
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R1C1"
Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!$A$1"

End Sub


_b) Lets say that I want to get the information from a "2D array" in the closed workbook. Lets say I want the information from the first 2 columns, and first 5 rows, like
R1C1:R5C2 or $A$1:$B$5

I can do this using closed workbook references. One way is to use the same fixed vector reference ** within a closed workbook reference applied across some spare range in the open workbook, macro.xlsm.

Lets say I want to put the reference into the first 2 columns and first 5 rows of the open workbook, macro.xlsm.
The fixed vector reference to apply to this range will be that, from a worksheets first cell to the worksheets first cell. In other words , A1 or R[0]C[0], ( or RC, as R defaults to R[0] etc.. ). I apply that reference to the first two columns and first 5 rows in the workbook, A1:B5

So if this is my closed workbook:
Closed_xlsm (_b).JPG : https://imgur.com/3f9U6M1
2372

then either of the following simple code lines in the following macro will return me the range of values from the range in the closed workbook, into the first two columns and first 5 rows in macro.xlsm

So after running the macro, Sub TestieClosedArrayRangeReference() , my first worksheet in macro.xlsm , will look like this
ClosedRefsInCellsA1toB5.JPG https://imgur.com/SzvBlea


Sub TestieClosedArrayRangeReference() ' http://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing?p=11431&viewfull=1#post11431
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!R[0]C[0]"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!RC"
Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Workbooks("macro.xlsm").Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

End Sub


Get 2D array from closed workbook
Finally, if I want to put that range of values into an array, then I simply use the available single line capture of a range of values using the .Value Property "Method" applied to that range in the macro.xlsm. ( After this I can delete, ( Clear ) , the temporary range of values).
As example: The following macro is in the uploaded file macro.xlsm. Download both macro.xlsm and Closed.xlsm into the same Folder.
Open just macro.xlsm. Leave Closed.xlsm closed. Run Sub Get2DArrayfromClosedWorkbook()
The values in range A1:B5 from the closed workbook, Closed.xlsm, will be placed in the array, MyArr()

Sub Get2DArrayfromClosedWorkbook()
Let ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value = "='" & ThisWorkbook.Path & "\[Closed.xlsm]somesheet'!A1"

Dim MyArr() As Variant
Let MyArr() = ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Value
ThisWorkbook.Worksheets.Item(1).Range("A1:B5").Clear

MsgBox Prompt:="As example of my array content, here is value from B4 in closed workbook:" & vbCrLf & "MyArr(4, 2) value is """ & MyArr(4, 2) & """"
End Sub









Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191








Ref
fixed vector reference ** In simple terms , this means simply a range reference in relative terms, ( so neglecting the $ in Column Letter and row number notation, or including the [ ] in row number and column number notation: https://teylyn.com/2017/03/21/dollarsigns/#comment-191

DocAElstein
10-28-2021, 11:28 AM
This is post #43 on Page 5 https://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing/page5#post 15722
https://www.excelfox.com/forum/showthread.php/2355-Tests-and-Notes-on-Range-Referrencing/page5#post 15722


In support of this Thread: http://www.excelfox.com/forum/showthread.php/2788-MULTICOLUMN-COMBOBOX-WITH-INDEX-APPLICATION?p=16398#post16398




Hello Amelynn
Welcome to ExcelFox , the thinking man’s Excel forum :)


Who can help me, ....I think, therefore I am , and able to help you.


...... I don't understand how the line ".List
= Application.Index(rng, Evaluate("ROW(1:" & rng.Rows.Count & ")"), Array(1, 3))
" works and I can't stay So....

To Explain

Array(1, 3)
It is like –
1 3
( Sometime we write in excel spreadsheet convention {1, 3} , but this usually means the same thing )

Evaluate("ROW(1:" & rng.Rows.Count & ")")

..... evaluate (…….. used to occupy excel formulas in vba) with row,
Correct! Good! - Because you understand this, it makes the explanation for me much easier.
We are really only interested in understanding what is , =ROW(1:" & rng.Rows.Count & ")" , in excel spreadsheet formula

For your range, rng = B4:D8 , rng.Rows.Count = 5
=ROW(1: " & rng.Rows.Count & " )
=ROW(1: " & 5 & " )
=ROW(1:5)

( Green is Excel Spreadsheet, Blue is VBA in string “ “ in Evaluate( “ “ ) )

The excel spreadsheet Row( ) function is usually like for
Row( A1) = 1
but can also return a “vertical” array of values like
Row( A1:A2) = 1
Row( A1:A2) = 2
In VBA Evaluate we find that we are decoupled from spreadsheet absolute values, and so in VBA Evaluate
Row(A1:A2) = Row( 1:2) = 1
Row(A1:A2) = Row( 1:2) = 2

ROW(1:5)
It is like
1
2
3
4
5
( Sometimes we may write
{1
2
3
4
5}
or sometimes we may write in excel spreadsheet convention , ={1;2;3;4;5} , but usually this means the same thing)
Note: For “vertical” array some excel use ; but some Excel use \ – So sometime you may need ={1\2\3\4\5}



Sometimes if we are lucky, Excel will try to do array calculations and return you an array.
Like

{ 1 2 X { 6 8 = { 1, 6 2, 8
3 4 } 7 9 } 3, 7 4, 9 }

But if you ask it to do = Index __ ROW(1:5)__ ,__ Array{1 , 3} it tries to look at columns and rows not specified.


= { 1 ? { 1 3
2 ? ? ?
3 ? X ? ?
4 ? ? ?
5 ? } ? ? }

???? So we have a problem ?,
But we can be luckyagain, because then Excel will guess to see this instead
( This is because of Excel VBA Interception and Implicit Intersection (http://www.excelfox.com/forum/showthread.php/2145-Excel-VBA-Interception-and-Implicit-Intersection-and-VLookUp) )


= { 1 1 { 1 3
2 2 1 3
3 3 X 1 3
4 4 1 3
5 5 } 1 3 }

Index will try to give us


_______ Index ( 1, 1 1, 3
2, 1 2, 3
3, 1 3, 3
4, 1 4, 3
5, 1 5, 3 )


So if your range is


rng = B4:D8 , rng.Rows.Count = 5

_B4 _C4 _D4
_B5 _C5 _D5
_B6 _C6 _D6
_B7 _C7 _D7
_B8 _C8 _D8

then Application.Index(rng, Evaluate("=ROW(1:" & rng.Rows.Count & ")"), Array(1, 3))
-__ =Application.Index(rng, Evaluate("=ROW(1:5)"), Array(1, 3))
-__ =Application.Index(rng, Evaluate("={1;2;3;4;5}"), Array(1, 3))
-__ =Application.Index(rng, Evaluate("={1;2;3;4;5}"), Evaluate("={1, 3}"))

= _B4 _D4
_B5 _D5
_B6 _D6
_B7 _D7
_B8 _D8




........use an array to determine the rows as well......
Sure, this is no problem:
One way, for example, for just 1st 3rd and 5th row
Change
Evaluate("={1;2;3;4;5}")
to
Evaluate("={1;3;5}")


Here a demo macro for you
Put some arbitrary values in your range "B4:D8" , then run this macro:

Sub Test()
Dim Rng As Range
Set Rng = Worksheets("Sheet1").Range("B4:D8")
Dim RwsCnt As Long
Let RwsCnt = Rng.Rows.Count ' is = 5

Dim arr_List() As Variant
Let arr_List() = Application.Index(Rng, Evaluate("=ROW(1:" & Rng.Rows.Count & ")"), Array(1, 3))
Let arr_List() = Application.Index(Rng, Evaluate("=ROW(1:" & RwsCnt & ")"), Array(1, 3))
Let arr_List() = Application.Index(Rng, Evaluate("=ROW(1:5)"), Array(1, 3))
Let arr_List() = Application.Index(Rng, Evaluate("={1;2;3;4;5}"), Array(1, 3))
Let arr_List() = Application.Index(Rng, Evaluate("={1;2;3;4;5}"), Evaluate("={1,3}"))

Let Worksheets("Sheet1").Range("A40").Resize(UBound(arr_List(), 1), UBound(arr_List(), 2)).Value = arr_List()

' To only select 1st 3rd and 5th row
Let arr_List() = Application.Index(Rng, Evaluate("={1;3;5}"), Evaluate("={1,3}"))
Let Worksheets("Sheet1").Range("A47").Resize(UBound(arr_List(), 1), UBound(arr_List(), 2)).Value = arr_List()

End Sub



Alan

DocAElstein
10-28-2021, 11:28 AM
Item way of thinking as alternative to conventional row column looping

Current conventional way of thinking
This Blog post assumes that you have some basic Excel VBA programming experience, and that you are familiar with this general idea used typically when filling or getting data from cells
__For Rw = 1 To maximumRows
____For Clm = 1 To maximumColumns
_____( Rw, Clm )
____Next Clm
__ Next Rw
This basic process you should make sure you fully understand before reading further.
This Blog post suggest a slightly different way about thinking about that process

Introduction
Excel Spreadsheets can be turned into pretty pictures, computer graphics and games and “dashboards”.
But they are usually not the best at doing those things.
They are best for doing things with 2 dimensional “tables” of data.
They bridge the gap between
_ dead stores of data or long fast streams of string data,
and
_ relatively slow and static living humans interacting with them

I expect we are not a long way from interacting in a 3 dimensional way, but it will settle down, I think, to be useful in a limited way. More than 3 dimensions are difficult for humans to react easily with.
A 2 dimensional desktop is particularly convenient for us.
Smartphones are a trend that I think might go back a bit to being just glorified telephones, walkmans, live cameras and simple computer games.

We are basically talking in this Thread about organising a string of data travelling at the speed of light into a static line or row of the data, then carrying the rest of the data back, feeding in another row or line or “going down”, then doing the same again.

I think for Excel formulas and VBA we should not take the core of the thinking much further than this.
For furthering the study and manipulation of static table data something else , another concept, such as Power Query / Get and Transform (https://excelfox.com/forum/forumdisplay.php/30-ETL-PQ-Tips-and-Tricks) might be more appropriate.

Looping along columns for every row The conventional way
__For Rw = 1 To maximumRows
____For Clm = 1 To maximumColumns
_____( Rw, Clm )
____Next Clm
__ Next Rw
This is what we have got used to, from reading books, to the workings of old printers, to how a screen is filed with data. It is an efficient and logical consequence that a spreadsheet, or a rectangular range in a spreadsheet, is filled and otherwise updated in the same way.
Usually we look at a cell when doing formula calculations, but if we increase the exposed area during a screen update, we can get an efficient, almost simultaneous, calculation across an entire range. This latter is the basis of the workings of the so called array formulas, ( “CSE” stuff ). We will come on to that in the next post

Looping the Items
Many things in VBA, and computers generally, are actually ordered somewhere by something similar to a unique item number , 1 2 3 4 5 6 … etc. ( Note: in some computer conventions the first may start at 0 so we have 0 1 2 3 4 5… etc. )
Conventionally, the Range Item numbers are also so organised, and further follow the generally accepted convention of
Across
_____down
back
Across
_____down
back
………etc.

( Conventionally in computer stream strings we may refer to those
backs as carriage returns, vbCr ,
and
the downs as line feeds, vbLf.
These may be referred to as “invisible characters”, as we do not typically see them, but they must be there in the electronic string stream to indicate the start of a new line or new row )

For example for a 2 row x 3 column range, this is where the item numbers are/ what cells the item number refers to
1 2 3
4 5 6
Furthermore, for many things that do not have such an item number they may have a consistent order such that we can assume or assign some simple count mechanism to give them an index that we can use in a similar way to the Item number

The crux of my suggestion in this Thread is to think of the basic process shown at the start of this Blog, in a slightly different way.
A couple of reasons I can think of for doing this
_ It may be helpful to think back to the more fundamental single string idea of what computers are, as the table type arrangement is only an interface for us, and is less representative of what is actually going on in a computer
_ In some situations the alternative looping may have some advantages. For example we would not be limited to a rectangular range.

Some simple required maths
What we want to do is this sort of thing as an alternative to the basic process
__For Itm = 1 To maximumItems
___( Row, Column)
__Next Itm
Before looking at the actual solution, lets simply put in words a simple solution idea, and consider again a 2 row, 3 column range
1 2 3
4 5 6
In this case, our maximumRows will be 2 and the maximumColumns will be 3
We have those sequentially numbers, and we want to convert then to row and column indices that would give us that spreadsheet range.

Row Number from Item Number
If we were to divide the actual item number by the maximumColumns , 3 , and take the integer of the result we would almost be there. But that would actually give us
0 0 1
1 1 2
If we were to first subtract 1 from the Item number, then do the same again, divide that modified number by the maximumColumns , 3, and take the integer of the result we would have,
Integer ( ( ItmNumber -1 ) / maximumColumns ) =
0 0 0
1 1 1
So we now see that we only have to add 1 to the final results and we have the row number what we want.
RowNumber = [ Integer ( ( ItmNumber -1 ) / maximumColumns ) ] + 1
1 1 1
2 2 2

Column Number from Item Number
This is slightly more tricky. But not much. I do this second as we need some of the ideas from the previous maths.
An observation:
The second row needs to be reduce by 1 x maximumColumns , and
if we had a third row the item number would need to be reduced by 2 x maximumColumns … and so on.
It also fits the same logic to apply a reduction of 0 x maximumColumns to the first row.
So we are looking for a multiplication factor based on the Item number which gives us that sort of number sequence like 0 0 0 ; 1 1 1 ; 2 2 2 etc. sequence
We can see from one of the stages in the maths from the last section that we did actually already have it at this stage:
Integer ( ( ItmNumber -1 ) / maximumColumns ) =
0 0 0
1 1 1
and that would have further gone on for more rows to
0 0 0 ; 1 1 1 ; 2 2 2 ; 3 3 3 … etc.

So we can see one formula possibility:
ItemNumber - [ Integer ( ( ItmNumber -1 ) / maximumColumns ) X maximumColumns ]
This would result in our required column Indicies of
1 2 3
1 2 3

_.______

Simple VBA macro example

Sub ItmNumbersLoopToRng()
Dim Ws1 As Worksheet: Set Ws1 = ThisWorkbook.Worksheets("Sheet1")
Dim ItmIndx As Long
Dim maxClms As Long, maxRws As Long: Let maxClms = 3: Let maxRws = 2
For ItmIndx = 1 To 5
Dim Rw As Long, Clm As Long
Let Rw = Int((ItmIndx - 1) / maxClms) + 1
Let Clm = ItmIndx - (Int((ItmIndx - 1) / maxClms) * maxClms)
Let Ws1.Cells.Item(Rw, Clm).Value = " (" & Rw & ", " & Clm & ")"
Next ItmIndx
End Sub

Sub ItmNumbersLoopToRng2()
Dim Ws1 As Worksheet: Set Ws1 = ThisWorkbook.Worksheets("Sheet1")
Dim ItmIndx As Long
Dim maxClms As Long, maxRws As Long: Let maxClms = 3: Let maxRws = 2
For ItmIndx = 1 To 5
' Dim Rw As Long, Clm As Long
' Let Rw = Int((ItmIndx - 1) / maxClms) + 1
' Let Clm = ItmIndx - (Int((ItmIndx - 1) / maxClms) * maxClms)
Let Ws1.Cells.Item(Int((ItmIndx - 1) / maxClms) + 1, ItmIndx - (Int((ItmIndx - 1) / maxClms) * maxClms)).Value = " (" & Int((ItmIndx - 1) / maxClms) + 1 & ", " & ItmIndx - (Int((ItmIndx - 1) / maxClms) * maxClms) & ")"
Next ItmIndx
End Sub


__Result:_____
_____ Workbook: OekyDoekyAmelynn.xls ( Using Excel 2007 32 bit )
Row\Col
A
B
C
D

1 (1, 1) (1, 2) (1, 3)


2 (2, 1) (2, 2)


3
Worksheet: Sheet1
_.____



There is one interesting observation already that may help us understand some of the secret workings of Excel:
Note that we have not needed to use the parameter of maximumRows
Now, Consider a range object of 3 columns x 2 rows anywhere in a spreadsheet
x x x
x x x
Reasonably we would say that has 6 items, and conventionally we have, and we could confirm by experiment, that we have item 6 as shown here, X:
x x x
x x X
What is somewhat surprising perhaps, is that we can go on to reference any further item without causing any errors, and we remain in the maximum columns restriction but seem to have no limit, ( within reason ), in the rows.
For example, referring to item 12, would get us here X:
x x x
x x x
x x x
x x X

This could be by design, or might just be an accident due to some internal calculations having a similar form to those I have suggested and discussed, and they do not have any consideration of maximum row



I intend adding some further post on this thread later to discuss the ideas and develop them further.

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:28 AM
Postz for later use

DocAElstein
10-28-2021, 11:36 AM
post for later

DocAElstein
10-28-2021, 11:36 AM
post for later

<iframe width="824" height="618" src="https://www.youtube.com/embed/OPPP3BXurHk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" ></iframe>

<iframe width="840" height="473" src="https://www.youtube.com/embed/J06yQb4lbPk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

DocAElstein
10-28-2021, 11:36 AM
post for later

DocAElstein
10-28-2021, 11:36 AM
post for later

<iframe width="824" height="618" src="https://www.youtube.com/embed/OPPP3BXurHk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" ></iframe>

<iframe width="840" height="473" src="https://www.youtube.com/embed/J06yQb4lbPk" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

DocAElstein
10-28-2021, 11:38 AM
In support of these Thread comments and posts
comment from 27 October, 2021-10-28 2021-10-27 05:05:17 https://excelribbon.tips.net/T011440_Selecting_a_Cell_in_the_Current_Row.html
https://excelfox.com/forum/showthread.php/2138-Understanding-VBA-Range-Object-Properties-and-referring-to-ranges-and-spreadsheet-cells?p=10035&viewfull=1#post10035
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551509 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551509
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023

Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080
https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080

DocAElstein
10-28-2021, 11:38 AM
In support of these Thread comments and posts
comment from 27 October, 2021-10-28 2021-10-27 05:05:17 https://excelribbon.tips.net/T011440_Selecting_a_Cell_in_the_Current_Row.html
https://excelfox.com/forum/showthread.php/2138-Understanding-VBA-Range-Object-Properties-and-referring-to-ranges-and-spreadsheet-cells?p=10035&viewfull=1#post10035
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551509 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551509
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023

Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080
https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080

DocAElstein
10-28-2021, 11:41 AM
In support of these Thread comments and posts
comment from 27 October, 2021-10-28 2021-10-27 05:05:17 https://excelribbon.tips.net/T011440_Selecting_a_Cell_in_the_Current_Row.html
https://excelfox.com/forum/showthread.php/2138-Understanding-VBA-Range-Object-Properties-and-referring-to-ranges-and-spreadsheet-cells?p=10035&viewfull=1#post10035
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551509 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551509
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023

Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080
https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080





Spreadsheet cell concept and Range Objects.
In my opinion, some unfortunate choice of words can set a new user of Excel slightly of course from the very start.
Further, form my experience in learning effective use of Excel , I would recommend, that any new user of Excel should try at least to get some basics of Excel’s programming ability, Visual Basic for Appplications, ( VBA ) , or at least understand some of the basic concept at an early stage. I am not alone in people who have been very annoyed to learn at a later date how much simpler and more effective use of VBA programming can be to many spreadsheet ways of doing things.
This language is, in simple terms , the programming language used to make most things happen when you manually do things in the spreadsheet. So you can replicate and modify existing Functions or write new ones from scratch. You can further arrange for them to happen automatically as a result of other things happening, or even , for example, at a certain time of day.
But the possibilities are almost endless, ( and consequently it seems to have been given up years ago trying to make any sort of all encompassing programming manuals! )
So I cannot possibly explain all Excel programming here, but I intend to touch on , from a Layman’s point of view, some of the parallel concepts in VBA to Spreadsheet things, in particular those I have found to confuse at a later stage of learning. I am at a very early learning stage myself and am not a programming professional. Much of my explanations are from a Layman’s observation point of view

Starting right at the beginning with the default Spreadsheet “grid” or “cell” structure.
We start typing things such as text or simple formulas in a cell. Right here we can go off course. The use of the word cell or cells is not a good idea in my opinion. Better would be the box you “write a string value or number in” ( or the “box you colour or format” in some way ) or if you are familiar with basic map or Atlas reading, you can regard it as the row and column numbers being like the y and x axis.
The main reason I say this, is that Cells is used specifically to refer to something else which specifically is not a “thing” or Object. It is much better, even before you start understanding any VBA, to get in the habit of using “Range Object” for the “box” “thing”. This should become clear in the next few sections.

Cells Property ( Method ) EDIT. This section is probably inorrect - see a few post later where I question the fundamental ideas of the Cells Property for referencing Range Objects
The word Cell, or more specifically a form like Cells(1, 2) is a VBA Property, ( what a layman would more easily initially understand as a Method or “way to do something”. ( Indeed it was previously referred, and some experts still do refer, to as a Method) . This can be thought of the programming equivalent of you taking ( that is to say , observing in your mind ) , for the given example, the entire first Spreadsheet first row ( from the top) , and the entire spreadsheet second column, ( from the left ). Where these intercept is taken as the “box” of interest which you are “referring to through the Cells Property”. In other words we have a “way” of getting it. Or at least a way to make reference to it. So in the first instance we would think of it as a Method or way of doing something. Such things, ( the “boxes” and all that can be done to them or “got” from them) are often held in a large list, at least a virtual list. We can “get at”, that is to say we have access to this list. This explains why often such things may be described as a Property, that is to say, something “belonging to it”, even if it is a “way of doing something”, - we cannot necessarily use all ways to do things on differentl things.

Object Orientated Programming
Some basics of Object Orientated Programming, OOP, is required at this point. Very , very simplified we have in most case a type of hierarchical system starting from the “biggest thing”, ( Object as we call them ) , from the left. Then going along to the right via a dot, . , we “go down the chain”, to under Objects , or use a Method or Property of an Object, applied to the object to return some Property.

Getting at ( referring to ) a cell ( Range Object )
Initially we are considering a simple case , or a single cell ( “box” ), but noting that in most cases we can do similar things to a collection of cells (“boxes”). The discussions are very similar for more than one “box”

Range Object
In my Opinion, it really is worth understanding what a Range Object is, even if you are not initially interested in VBA programming.
In simple terms, all that can be done to or changed, or “seen” in a “box”, ( and much more besides, such as various information ) , are stored in a massive “thing” called a Range Object.
Using VBA you can easily “get at” all this information. In a spreadsheet, you only see some of this information. Taking for example a simple formula, =A2 , in the first “box”, ( the “box” at A1 “coordinate” ) that is to say the Range Object to be found at, that is to say by “using”, Cells(1, 1).
In the spreadsheet we can see for example the formula in “column letter and row number notation” displayed in the formula bar, ( small fx window at the top ), and the evaluated value in the first “box”. A simple VBA code can be written such as this below, to show much more detail. ( Further code could then be used to retrieve all that information )


Option Explicit
' To Run Code, Click within code, Hit play Button or F5 (or F8 to step through)
Sub Cell1EqualsCell2()
Let Worksheets("RangeObjects").Cells(1, 1).Value = "=A2"
Dim RngObj As Range ' ' EP Dim: For the Variable type declared, there should be some Blue Print or master Instruction list. If not The code will error at the start as it need to examine and therefore prepare for usage of the variable in the code run. The variable itself will go to some “Pigeon hole” that has a copy of the instructions or in some way has information on how to use the original instructions such that it can distinguish between different variables of the same type. When the code meets the variable it will look in the Pigeon Hole Pointer for instructions as to what to do in various situations. Knowing of the type allows in addition to get easily at the Methods and Properties through the applying of a period ( .Dot) ( intellisense ). Note this is a look up type list and may not be a guarantee that every offered thing is available – most will be typically.
Set RngObj = Worksheets("RangeObjects").Cells(1, 1) ' ' EP Set: Setting to a Class will involve the use of an extra New at this code line. I will then have an Object referred to as an instance of a Class. At this point I include information on my Pointer Pigeon hole for a distinct distinguishable usage of an Object of the Class. For the case of something such as a Workbook this instancing has already been done, and in addition some values are filled in specific memory locations which are also held as part of the information in the Pigeon Hole Pointer. Wed will have a different Pointer for each instance. In most excel versions we already have a few instances of Worksheets. Such instances Objects can be further used., - For this a Dim to the class will be necessary, but the New must be omitted at Set. I can assign as many variables that I wish to the same existing instance
End Sub ' Click in left margin to get brown stop icon. Run Code. It will then stop here
' Highlight either ' ' RngObj '.Hit Shift+F9. Select Add.
' Hit +'s in Watch Window to reveal contents of Watch Window

To Run the Code:
To Install a macro:
1. Copy the code given to the clipboard. ( Highlight code and Hit Ctrl C )
2. Open a NEW workbook ( or the one you want the code in )
(2a. Either rename a Tab now to RangeObjects, or later, **change the code in two places to the name of a spare existing Worksheet tab Name ( Typically this will be “Sheet1” for English Excel, corresponding to the first tab named Sheet1 ) )
3. Press the keys ALT + F11 to open the Visual Basic Editor
At this point you should see the cursor flashing in a big empty window
( If not then select from the VB Editor ribbon ---- Insert ------ module )
4. Where the cursor is flashing, paste the code
( 5a. **Do any editing of the code you wish to at this stage. )

To run in “Development mode”
5b. Adjust window Sizes if necessary so as to see both the Visual Basic Editor and the Spreadsheet
5c. Click within code
5d(i). Hit play Button or F5 (or F8 to step through)
5d(ii). If you wish to look into filled variables, stop the code at the End Sub and follow ‘ instructions to reveal variables contents )

To Run Code in final finished form
6. Press the keys ALT + F11 to return to Excel ( or press ALT and q simultaneously to close the VB Editor )
7. When in Excel, press ALT + F8 to display the Run Macro Dialog.
8. You can choose to run the code ( alternatively Double Click the macro's name to Run it.)
Or
9. You can choose to work on it. – This option is good to find the macro if you have many and are not sure where they all are )

This is what you should see if you follow the instructions to bring up the Watch Window to reveal the contents of the variable used for the Range Object of the first Worksheet cell ( “box” )
Cells1EqualsCells2.JPG http://imgur.com/wXjd0xq
4952833659https://i.postimg.cc/MKtkJGN2/Cells1-Equals-Cells2.jpg (https://postimages.org/)

DocAElstein
10-28-2021, 11:41 AM
In support of these Thread comments and posts
comment from 27 October, 2021-10-28 2021-10-27 05:05:17 https://excelribbon.tips.net/T011440_Selecting_a_Cell_in_the_Current_Row.html
https://excelfox.com/forum/showthread.php/2138-Understanding-VBA-Range-Object-Properties-and-referring-to-ranges-and-spreadsheet-cells?p=10035&viewfull=1#post10035
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551509 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551509
http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023

Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551080
https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551080





Spreadsheet cell concept and Range Objects.
In my opinion, some unfortunate choice of words can set a new user of Excel slightly of course from the very start.
Further, form my experience in learning effective use of Excel , I would recommend, that any new user of Excel should try at least to get some basics of Excel’s programming ability, Visual Basic for Appplications, ( VBA ) , or at least understand some of the basic concept at an early stage. I am not alone in people who have been very annoyed to learn at a later date how much simpler and more effective use of VBA programming can be to many spreadsheet ways of doing things.
This language is, in simple terms , the programming language used to make most things happen when you manually do things in the spreadsheet. So you can replicate and modify existing Functions or write new ones from scratch. You can further arrange for them to happen automatically as a result of other things happening, or even , for example, at a certain time of day.
But the possibilities are almost endless, ( and consequently it seems to have been given up years ago trying to make any sort of all encompassing programming manuals! )
So I cannot possibly explain all Excel programming here, but I intend to touch on , from a Layman’s point of view, some of the parallel concepts in VBA to Spreadsheet things, in particular those I have found to confuse at a later stage of learning. I am at a very early learning stage myself and am not a programming professional. Much of my explanations are from a Layman’s observation point of view

Starting right at the beginning with the default Spreadsheet “grid” or “cell” structure.
We start typing things such as text or simple formulas in a cell. Right here we can go off course. The use of the word cell or cells is not a good idea in my opinion. Better would be the box you “write a string value or number in” ( or the “box you colour or format” in some way ) or if you are familiar with basic map or Atlas reading, you can regard it as the row and column numbers being like the y and x axis.
The main reason I say this, is that Cells is used specifically to refer to something else which specifically is not a “thing” or Object. It is much better, even before you start understanding any VBA, to get in the habit of using “Range Object” for the “box” “thing”. This should become clear in the next few sections.

Cells Property ( Method ) EDIT. This section is probably inorrect - see a few post later where I question the fundamental ideas of the Cells Property for referencing Range Objects
The word Cell, or more specifically a form like Cells(1, 2) is a VBA Property, ( what a layman would more easily initially understand as a Method or “way to do something”. ( Indeed it was previously referred, and some experts still do refer, to as a Method) . This can be thought of the programming equivalent of you taking ( that is to say , observing in your mind ) , for the given example, the entire first Spreadsheet first row ( from the top) , and the entire spreadsheet second column, ( from the left ). Where these intercept is taken as the “box” of interest which you are “referring to through the Cells Property”. In other words we have a “way” of getting it. Or at least a way to make reference to it. So in the first instance we would think of it as a Method or way of doing something. Such things, ( the “boxes” and all that can be done to them or “got” from them) are often held in a large list, at least a virtual list. We can “get at”, that is to say we have access to this list. This explains why often such things may be described as a Property, that is to say, something “belonging to it”, even if it is a “way of doing something”, - we cannot necessarily use all ways to do things on differentl things.

Object Orientated Programming
Some basics of Object Orientated Programming, OOP, is required at this point. Very , very simplified we have in most case a type of hierarchical system starting from the “biggest thing”, ( Object as we call them ) , from the left. Then going along to the right via a dot, . , we “go down the chain”, to under Objects , or use a Method or Property of an Object, applied to the object to return some Property.

Getting at ( referring to ) a cell ( Range Object )
Initially we are considering a simple case , or a single cell ( “box” ), but noting that in most cases we can do similar things to a collection of cells (“boxes”). The discussions are very similar for more than one “box”

Range Object
In my Opinion, it really is worth understanding what a Range Object is, even if you are not initially interested in VBA programming.
In simple terms, all that can be done to or changed, or “seen” in a “box”, ( and much more besides, such as various information ) , are stored in a massive “thing” called a Range Object.
Using VBA you can easily “get at” all this information. In a spreadsheet, you only see some of this information. Taking for example a simple formula, =A2 , in the first “box”, ( the “box” at A1 “coordinate” ) that is to say the Range Object to be found at, that is to say by “using”, Cells(1, 1).
In the spreadsheet we can see for example the formula in “column letter and row number notation” displayed in the formula bar, ( small fx window at the top ), and the evaluated value in the first “box”. A simple VBA code can be written such as this below, to show much more detail. ( Further code could then be used to retrieve all that information )


Option Explicit
' To Run Code, Click within code, Hit play Button or F5 (or F8 to step through)
Sub Cell1EqualsCell2()
Let Worksheets("RangeObjects").Cells(1, 1).Value = "=A2"
Dim RngObj As Range ' ' EP Dim: For the Variable type declared, there should be some Blue Print or master Instruction list. If not The code will error at the start as it need to examine and therefore prepare for usage of the variable in the code run. The variable itself will go to some “Pigeon hole” that has a copy of the instructions or in some way has information on how to use the original instructions such that it can distinguish between different variables of the same type. When the code meets the variable it will look in the Pigeon Hole Pointer for instructions as to what to do in various situations. Knowing of the type allows in addition to get easily at the Methods and Properties through the applying of a period ( .Dot) ( intellisense ). Note this is a look up type list and may not be a guarantee that every offered thing is available – most will be typically.
Set RngObj = Worksheets("RangeObjects").Cells(1, 1) ' ' EP Set: Setting to a Class will involve the use of an extra New at this code line. I will then have an Object referred to as an instance of a Class. At this point I include information on my Pointer Pigeon hole for a distinct distinguishable usage of an Object of the Class. For the case of something such as a Workbook this instancing has already been done, and in addition some values are filled in specific memory locations which are also held as part of the information in the Pigeon Hole Pointer. Wed will have a different Pointer for each instance. In most excel versions we already have a few instances of Worksheets. Such instances Objects can be further used., - For this a Dim to the class will be necessary, but the New must be omitted at Set. I can assign as many variables that I wish to the same existing instance
End Sub ' Click in left margin to get brown stop icon. Run Code. It will then stop here
' Highlight either ' ' RngObj '.Hit Shift+F9. Select Add.
' Hit +'s in Watch Window to reveal contents of Watch Window

To Run the Code:
To Install a macro:
1. Copy the code given to the clipboard. ( Highlight code and Hit Ctrl C )
2. Open a NEW workbook ( or the one you want the code in )
(2a. Either rename a Tab now to RangeObjects, or later, **change the code in two places to the name of a spare existing Worksheet tab Name ( Typically this will be “Sheet1” for English Excel, corresponding to the first tab named Sheet1 ) )
3. Press the keys ALT + F11 to open the Visual Basic Editor
At this point you should see the cursor flashing in a big empty window
( If not then select from the VB Editor ribbon ---- Insert ------ module )
4. Where the cursor is flashing, paste the code
( 5a. **Do any editing of the code you wish to at this stage. )

To run in “Development mode”
5b. Adjust window Sizes if necessary so as to see both the Visual Basic Editor and the Spreadsheet
5c. Click within code
5d(i). Hit play Button or F5 (or F8 to step through)
5d(ii). If you wish to look into filled variables, stop the code at the End Sub and follow ‘ instructions to reveal variables contents )

To Run Code in final finished form
6. Press the keys ALT + F11 to return to Excel ( or press ALT and q simultaneously to close the VB Editor )
7. When in Excel, press ALT + F8 to display the Run Macro Dialog.
8. You can choose to run the code ( alternatively Double Click the macro's name to Run it.)
Or
9. You can choose to work on it. – This option is good to find the macro if you have many and are not sure where they all are )

This is what you should see if you follow the instructions to bring up the Watch Window to reveal the contents of the variable used for the Range Object of the first Worksheet cell ( “box” )
Cells1EqualsCells2.JPG http://imgur.com/wXjd0xq
4952833659https://i.postimg.cc/MKtkJGN2/Cells1-Equals-Cells2.jpg (https://postimages.org/)

DocAElstein
10-28-2021, 11:52 AM
Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551509 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551509




_1 ) Referring to Range Objects in VBA

I guess to some extent, I may be questioning / commenting on two basic statements or ideas
_(i) ... “...the most basic way of referring to Excel’s VBA Range object: the Range ( or Cells ) Property..”...
and
_(ii) whether there may be an additional Range Object ( The Application Range Object ) , that is to say , additional to the
..”... Range Object is “ .. (always ) .. “ contained within the Worksheet Object...”...
The latter, _(ii) , is possibly dubious, and possibly I could alternatively be suggesting that we have a sort of Application Range(“ “) Method ( or Application Range(“ “) Property, which is an alternative _c) to _..
_a) Cells Property
_b) Range Property
_.. , and which can be used to reference a Range

_1a ) _1b) Referring to Range Object contained within a Worksheet Object
_1c ) Referring to a ( Application ? ) Range Object

The documentation is not perfectly clear on this, at least that is the opinion of much more VBA experienced people than me. So the following is partly my interpretation.( Especially _1c) ).
I would suggest we can get at a Range Object in three basic ways. I deliberately list things a bit in a jumbled order, as things in the “imaginary” world are often in a seemingly incorrect order.
_1c) Directly through some specific reference.
( http://excelmatters.com/referring-to-ranges-in-vba/#comment-197138 )
_1a) indirectly using the Cells Property ( Method ) already discussed. http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551484#post4551080 http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551484#post4551484
_1b) indirectly using a similar Property to that in _1a), which unfortunately someone in their wisdom decided to call the Range Property. This Range Property is a “way” or “Method like” thing and should not be confused with the final big “thing” of the Range Object.

_1a) 1b) The general typical Ideas given for referring to Range Objects in VBA.

Let’s say, I have defined Rng as a Range Object. Then this type of code ( used within the Excel Application in VBA code ): _..
_1a)(i) Rng=Worksheets(1).Cells(1, 1)
or
_1a)(i) Rng=Worksheets.Item(1).Cells(1, 1)
_.. is using the Cells Property of a Worksheet to return the Range Object of the first cell in the first Worksheet ( Index / Item Number 1 counting Worksheet Tabs from the left ).
The same again using a string name ( assuming the first Worksheets has the default English Excel name of “Sheet1” )
_1a)(i) Rng=Worksheets(“Sheet1”).Cells(1, 1)
or
_1a)(i) Rng=Worksheets.Item(“Sheet1”).Cells(1, 1)

Similarly the Range Property of the worksheet can be used
_1a)(ii) Rng=Worksheets(1).Range(“A1”)
or
_1a)(ii) Rng=Worksheets(“Sheet1”).Range(“A1”)
etc.. etc....

My experiments suggest the following is also acceptable for the same, and I am not sure if VBA may actually change _1a(ii) “internally” as it were, to this type of form
_1a)(iii) Rng=Worksheets(1).Range("='[MyFile.xlsm]Sheet1'!A1")
This last :1a)(iii) would still be using the Range Property of the worksheet. I think before and up to this point we are clearly using the Cells or Range Properties of a Worksheet. This last suggestion, _1a)(iii) , I am, in fact not too sure about and in end effect a Range Object must be returned, so this could be how VBA finally sees the final returned Range Object:-
_1b)(i) Rng=Application.Range("='[MyFile.xlsm]Sheet1'!A1")
This last one, I think, is a Range Object, but I am not too sure? We could have used this initially and hence , I think, possibly would have a more basic way of cell referencing with _1b)(i), that is to say explicitly referring to the Application Range. So finally we have _1c) Rng=Application.Range("='[MyFile.xlsm]Sheet1'!A1") ( A suggestion / proposal from me )

_._____________________________
A few further related concepts

Unqualified Range reference,
One sees most typically a shortened version, an “unqualified” Range reference, of this type of form
Rng=Range(“A1”)
This leads to uncertainties.
_A) Used within a Normal code module. The last code line above will default ( that is to say what VBA “sees” ) to this sort of form
_1b)(ii) Rng=Application.Range("='[" & ActiveWorkbook.Name & "]" & ActiveSheet.Name & "'!A1")
which is again, I think, a Range reference, possibly to be regarded as referencing explicitly or directly by a Range Object? So I think we are referring Explicitly through a Range Object.
We are defaulting here, in the case of the code line in a Normal Code module, to the Application Range and not to the Active Worksheets as often said.
It is possible that my idea of an Explicit reference through an Application Range Object could be called an Application Range Property, So I am touching on dodgy uncertain ground here.
Application Range Object *#*#*
http://www.mrexcel.com/forum/excel-questions/905371-selecting-range-different-worksheets-error.html#post4357003
http://excelmatters.com/referring-to-ranges-in-vba/#comment-197138
_B) Use of an “unqualified” Range reference for the instance of a Class Worksheets, that is to say put in, for example, the Worksheet code module of Worksheets(2), will default ( that is to say what VBA “sees” ) to this sort of form
_1a)(iii) Rng= Worksheets(2).Range("='[" & ActiveWorkbook.Name & "]" & Worksheets(2).Name & "'!A1")
Which I think is referring through a Range Property.

Range and Cells() ( and Item ) Properties of Ranges ( Range Range Property , Range Item Property ) and Range Cells Property )
We have been talking so far about the Range and Cells() Properties of Worksheets as well as my suggestion of an Application Range ( which we are leaving it uncertain currently as to whether it is an Application Range Object or Application Range Property *#*#* )
In any case we have finally in all cases a Range Object. Regardless of where this is, we have a further (a)(ii)) Range(“ “) and (a)(i)) Cells() Property!!!!!, of a form such as
Range(“A2”) and Cells(2, 1) , or pseudo like
Range(strAddress) and Cells(row_coordinate, column_coordinate)
Specifically here for the Range( ) case, we are limited to an Address string and not a full reference.
The Range and Cells() Properties of a worksheet we have seen extend from ( are referenced to ) the Top left of a Worksheet. Similarly, the Range and Cells() Properties of a Range Object extend from (are referenced to ) the Top left of the range Object. _...
_... For example:
_1c) Rng=Application.Range("=[Workbook]Worksheets(1)!A1").Range(strAddress)
Is applying the a Range Property to the Range Object from _1b)(i)
You can keep going infinitely with rng.Range.Range.Range.Range. Each Range Property returning a new modified Range Object to which the next Range property is applied.
For the case of a Range Object Range Property, negative numbers and negative column letters are not from the syntax allowed.
However for the case of the Range Object Cells() Property, negative co ordinates are permitted.. Note here however two things here:
Firstly, the Range Object will need to have its top left far enough away from the Worksheet Top left origin such that the negative co ordinate applied Cells() Property does not go “further back to the left” or “further back up” than the Spreadsheet boundaries; and secondly, zeros in such as this Property reference, Cells( 0, 0 ) , is also from the syntax valid. So For example, _..
Range("A2:C5").Cells(0, 1)
_.. will return finally the Range Object of the ( cell ) “box” at Address A1, ... ( We apply the Cells() Property to the top left cell of the range Object which is A2. O gives 1 row back up from row 2, and 1 gives the same column as column A )

( ......The Item Property: Many things in VBA can be referenced through a consecutive Item Number, or Index, like 1, 2, 3 ... etc. The order is determined in various ways for the different things. The typical syntax is then Item(Whole_Number) and is usually read only.
For the case of a Range Object, this number relates to each ( cell ) “box” in the Range Object. This ordering follows the typical Excel Spreadsheet ( cells ) “boxes” order convention of numbered from left to right and from top to bottom. We may use this to reference (cells) “boxes” outside the Range Object that lie within the Worksheet boundaries. These "Overshoot" Items follow further the row then column convention , effectively "duplicating down" the Worksheet, that is to say repeating the original Range Object vertically down the Worksheet )..
It is a further confusing aspect of the Range Object that for the Range Item Property we may also use two arguments in the ( ) bracket representing the row, and column. If this option is chosen then we can use Numbers or , for the columns , also the letter (wrapped in quotations). In the two argument case we extend beyond the original Range Object from the top left in the Original Range Object in the usual row, column way, ( we do not proceed in a duplicate type way in Ranges Objects stacked down the Worksheet ) .
!!!!!To complete the confusion_... there may be no Cells Property see next post......).
_..................................

What is all this Post about. ?
Two things really
_( One) 1a) 1b) ) A review of the more common ideas of Range Objects and Range and Cells() Properties, with a mind to going on to make a suggestion , or at least discussion on a , a possible Explicit-er Application Range Object ( or Application Range Property or even Application Range Method )_.. that is to say _1c) _..
_.. _( Two) 1c) ) The end result of all the above, is that I have got recently into always using variations of this type of way to reference a Range Object.

Sub strRefAppRngObj() ' http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551509&highlight=#post4551509
' 1c) Application Range Object
Dim strRef As String ' Prepares "Pointer" to a "Blue Print" (or Form, Questionnaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular “Value”, or (“Values” for Objects). There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quick checks.. But...http://www.mrexcel.com/forum/excel-q...html#post44 '
Let strRef = "='[" & ThisWorkbook.Name & "]" & Worksheets.Item(1).Name & "'!A1:C3"
Dim Rng As Range ' EP Dim: For the Variable type declared, there should be some Blue Print or master Instruction list. If not The code will error at the start as it need to examine and therefore prepare for usage of the variable in the code run. The variable itself will go to some “Pigeon hole” that has a copy of the instructions or in some way has information on how to use the original instructions such that it can distinguish between different variables of the same type. When the code meets the variable it will look in the Pigeon Hole Pointer for instructions as to what to do in various situations. Knowing of the type allows in addition to get easily at the Methods and Properties through the applying of a period ( .Dot) ( intellisense ). Note this is a look up type list and may not be a guarantee that every offered thing is available – most will be typically.
Set Rng = Application.Range(strRef) ' EP Set: Setting to a Class will involve the use of an extra New at this code line. I will then have an Object referred to as an instance of a Class. At this point I include information on my Pointer Pigeon hole for a distinct distinguishable usage of an Object of the Class. For the case of something such as a Workbook this instancing has already been done, and in addition some values are filled in specific memory locations which are also held as part of the information in the Pigeon Hole Pointer. Wed will have a different Pointer for each instance. In most excel versions we already have a few instances of Worksheets. Such instances Objects can be further used., - For this a Dim to the class will be necessary, but the New must be omitted at Set. I can assign as many variables that I wish to the same existing instance
End Sub
Although the long string reference, strRef, looks daunting, I find this a robust way to reference a Range Object:
It gives me flexibility in the string build, and I have no confusion arising from where the code line might be... ( ... I reference the same Range Object, without generally any errors arising in the attempt, for the code line in any code Module )

Alan

' Rem Ref http://powerspreadsheets.com/excel-vba-range-object/

DocAElstein
10-28-2021, 11:52 AM
Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551509 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551509




_1 ) Referring to Range Objects in VBA

I guess to some extent, I may be questioning / commenting on two basic statements or ideas
_(i) ... “...the most basic way of referring to Excel’s VBA Range object: the Range ( or Cells ) Property..”...
and
_(ii) whether there may be an additional Range Object ( The Application Range Object ) , that is to say , additional to the
..”... Range Object is “ .. (always ) .. “ contained within the Worksheet Object...”...
The latter, _(ii) , is possibly dubious, and possibly I could alternatively be suggesting that we have a sort of Application Range(“ “) Method ( or Application Range(“ “) Property, which is an alternative _c) to _..
_a) Cells Property
_b) Range Property
_.. , and which can be used to reference a Range

_1a ) _1b) Referring to Range Object contained within a Worksheet Object
_1c ) Referring to a ( Application ? ) Range Object

The documentation is not perfectly clear on this, at least that is the opinion of much more VBA experienced people than me. So the following is partly my interpretation.( Especially _1c) ).
I would suggest we can get at a Range Object in three basic ways. I deliberately list things a bit in a jumbled order, as things in the “imaginary” world are often in a seemingly incorrect order.
_1c) Directly through some specific reference.
( http://excelmatters.com/referring-to-ranges-in-vba/#comment-197138 )
_1a) indirectly using the Cells Property ( Method ) already discussed. http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551484#post4551080 http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551484#post4551484
_1b) indirectly using a similar Property to that in _1a), which unfortunately someone in their wisdom decided to call the Range Property. This Range Property is a “way” or “Method like” thing and should not be confused with the final big “thing” of the Range Object.

_1a) 1b) The general typical Ideas given for referring to Range Objects in VBA.

Let’s say, I have defined Rng as a Range Object. Then this type of code ( used within the Excel Application in VBA code ): _..
_1a)(i) Rng=Worksheets(1).Cells(1, 1)
or
_1a)(i) Rng=Worksheets.Item(1).Cells(1, 1)
_.. is using the Cells Property of a Worksheet to return the Range Object of the first cell in the first Worksheet ( Index / Item Number 1 counting Worksheet Tabs from the left ).
The same again using a string name ( assuming the first Worksheets has the default English Excel name of “Sheet1” )
_1a)(i) Rng=Worksheets(“Sheet1”).Cells(1, 1)
or
_1a)(i) Rng=Worksheets.Item(“Sheet1”).Cells(1, 1)

Similarly the Range Property of the worksheet can be used
_1a)(ii) Rng=Worksheets(1).Range(“A1”)
or
_1a)(ii) Rng=Worksheets(“Sheet1”).Range(“A1”)
etc.. etc....

My experiments suggest the following is also acceptable for the same, and I am not sure if VBA may actually change _1a(ii) “internally” as it were, to this type of form
_1a)(iii) Rng=Worksheets(1).Range("='[MyFile.xlsm]Sheet1'!A1")
This last :1a)(iii) would still be using the Range Property of the worksheet. I think before and up to this point we are clearly using the Cells or Range Properties of a Worksheet. This last suggestion, _1a)(iii) , I am, in fact not too sure about and in end effect a Range Object must be returned, so this could be how VBA finally sees the final returned Range Object:-
_1b)(i) Rng=Application.Range("='[MyFile.xlsm]Sheet1'!A1")
This last one, I think, is a Range Object, but I am not too sure? We could have used this initially and hence , I think, possibly would have a more basic way of cell referencing with _1b)(i), that is to say explicitly referring to the Application Range. So finally we have _1c) Rng=Application.Range("='[MyFile.xlsm]Sheet1'!A1") ( A suggestion / proposal from me )

_._____________________________
A few further related concepts

Unqualified Range reference,
One sees most typically a shortened version, an “unqualified” Range reference, of this type of form
Rng=Range(“A1”)
This leads to uncertainties.
_A) Used within a Normal code module. The last code line above will default ( that is to say what VBA “sees” ) to this sort of form
_1b)(ii) Rng=Application.Range("='[" & ActiveWorkbook.Name & "]" & ActiveSheet.Name & "'!A1")
which is again, I think, a Range reference, possibly to be regarded as referencing explicitly or directly by a Range Object? So I think we are referring Explicitly through a Range Object.
We are defaulting here, in the case of the code line in a Normal Code module, to the Application Range and not to the Active Worksheets as often said.
It is possible that my idea of an Explicit reference through an Application Range Object could be called an Application Range Property, So I am touching on dodgy uncertain ground here.
Application Range Object *#*#*
http://www.mrexcel.com/forum/excel-questions/905371-selecting-range-different-worksheets-error.html#post4357003
http://excelmatters.com/referring-to-ranges-in-vba/#comment-197138
_B) Use of an “unqualified” Range reference for the instance of a Class Worksheets, that is to say put in, for example, the Worksheet code module of Worksheets(2), will default ( that is to say what VBA “sees” ) to this sort of form
_1a)(iii) Rng= Worksheets(2).Range("='[" & ActiveWorkbook.Name & "]" & Worksheets(2).Name & "'!A1")
Which I think is referring through a Range Property.

Range and Cells() ( and Item ) Properties of Ranges ( Range Range Property , Range Item Property ) and Range Cells Property )
We have been talking so far about the Range and Cells() Properties of Worksheets as well as my suggestion of an Application Range ( which we are leaving it uncertain currently as to whether it is an Application Range Object or Application Range Property *#*#* )
In any case we have finally in all cases a Range Object. Regardless of where this is, we have a further (a)(ii)) Range(“ “) and (a)(i)) Cells() Property!!!!!, of a form such as
Range(“A2”) and Cells(2, 1) , or pseudo like
Range(strAddress) and Cells(row_coordinate, column_coordinate)
Specifically here for the Range( ) case, we are limited to an Address string and not a full reference.
The Range and Cells() Properties of a worksheet we have seen extend from ( are referenced to ) the Top left of a Worksheet. Similarly, the Range and Cells() Properties of a Range Object extend from (are referenced to ) the Top left of the range Object. _...
_... For example:
_1c) Rng=Application.Range("=[Workbook]Worksheets(1)!A1").Range(strAddress)
Is applying the a Range Property to the Range Object from _1b)(i)
You can keep going infinitely with rng.Range.Range.Range.Range. Each Range Property returning a new modified Range Object to which the next Range property is applied.
For the case of a Range Object Range Property, negative numbers and negative column letters are not from the syntax allowed.
However for the case of the Range Object Cells() Property, negative co ordinates are permitted.. Note here however two things here:
Firstly, the Range Object will need to have its top left far enough away from the Worksheet Top left origin such that the negative co ordinate applied Cells() Property does not go “further back to the left” or “further back up” than the Spreadsheet boundaries; and secondly, zeros in such as this Property reference, Cells( 0, 0 ) , is also from the syntax valid. So For example, _..
Range("A2:C5").Cells(0, 1)
_.. will return finally the Range Object of the ( cell ) “box” at Address A1, ... ( We apply the Cells() Property to the top left cell of the range Object which is A2. O gives 1 row back up from row 2, and 1 gives the same column as column A )

( ......The Item Property: Many things in VBA can be referenced through a consecutive Item Number, or Index, like 1, 2, 3 ... etc. The order is determined in various ways for the different things. The typical syntax is then Item(Whole_Number) and is usually read only.
For the case of a Range Object, this number relates to each ( cell ) “box” in the Range Object. This ordering follows the typical Excel Spreadsheet ( cells ) “boxes” order convention of numbered from left to right and from top to bottom. We may use this to reference (cells) “boxes” outside the Range Object that lie within the Worksheet boundaries. These "Overshoot" Items follow further the row then column convention , effectively "duplicating down" the Worksheet, that is to say repeating the original Range Object vertically down the Worksheet )..
It is a further confusing aspect of the Range Object that for the Range Item Property we may also use two arguments in the ( ) bracket representing the row, and column. If this option is chosen then we can use Numbers or , for the columns , also the letter (wrapped in quotations). In the two argument case we extend beyond the original Range Object from the top left in the Original Range Object in the usual row, column way, ( we do not proceed in a duplicate type way in Ranges Objects stacked down the Worksheet ) .
!!!!!To complete the confusion_... there may be no Cells Property see next post......).
_..................................

What is all this Post about. ?
Two things really
_( One) 1a) 1b) ) A review of the more common ideas of Range Objects and Range and Cells() Properties, with a mind to going on to make a suggestion , or at least discussion on a , a possible Explicit-er Application Range Object ( or Application Range Property or even Application Range Method )_.. that is to say _1c) _..
_.. _( Two) 1c) ) The end result of all the above, is that I have got recently into always using variations of this type of way to reference a Range Object.

Sub strRefAppRngObj() ' http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551509&highlight=#post4551509
' 1c) Application Range Object
Dim strRef As String ' Prepares "Pointer" to a "Blue Print" (or Form, Questionnaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular “Value”, or (“Values” for Objects). There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quick checks.. But...http://www.mrexcel.com/forum/excel-q...html#post44 '
Let strRef = "='[" & ThisWorkbook.Name & "]" & Worksheets.Item(1).Name & "'!A1:C3"
Dim Rng As Range ' EP Dim: For the Variable type declared, there should be some Blue Print or master Instruction list. If not The code will error at the start as it need to examine and therefore prepare for usage of the variable in the code run. The variable itself will go to some “Pigeon hole” that has a copy of the instructions or in some way has information on how to use the original instructions such that it can distinguish between different variables of the same type. When the code meets the variable it will look in the Pigeon Hole Pointer for instructions as to what to do in various situations. Knowing of the type allows in addition to get easily at the Methods and Properties through the applying of a period ( .Dot) ( intellisense ). Note this is a look up type list and may not be a guarantee that every offered thing is available – most will be typically.
Set Rng = Application.Range(strRef) ' EP Set: Setting to a Class will involve the use of an extra New at this code line. I will then have an Object referred to as an instance of a Class. At this point I include information on my Pointer Pigeon hole for a distinct distinguishable usage of an Object of the Class. For the case of something such as a Workbook this instancing has already been done, and in addition some values are filled in specific memory locations which are also held as part of the information in the Pigeon Hole Pointer. Wed will have a different Pointer for each instance. In most excel versions we already have a few instances of Worksheets. Such instances Objects can be further used., - For this a Dim to the class will be necessary, but the New must be omitted at Set. I can assign as many variables that I wish to the same existing instance
End Sub
Although the long string reference, strRef, looks daunting, I find this a robust way to reference a Range Object:
It gives me flexibility in the string build, and I have no confusion arising from where the code line might be... ( ... I reference the same Range Object, without generally any errors arising in the attempt, for the code line in any code Module )

Alan

' Rem Ref http://powerspreadsheets.com/excel-vba-range-object/

DocAElstein
10-28-2021, 11:52 AM
Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4551509 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4551509




_1 ) Referring to Range Objects in VBA

I guess to some extent, I may be questioning / commenting on two basic statements or ideas
_(i) ... “...the most basic way of referring to Excel’s VBA Range object: the Range ( or Cells ) Property..”...
and
_(ii) whether there may be an additional Range Object ( The Application Range Object ) , that is to say , additional to the
..”... Range Object is “ .. (always ) .. “ contained within the Worksheet Object...”...
The latter, _(ii) , is possibly dubious, and possibly I could alternatively be suggesting that we have a sort of Application Range(“ “) Method ( or Application Range(“ “) Property, which is an alternative _c) to _..
_a) Cells Property
_b) Range Property
_.. , and which can be used to reference a Range

_1a ) _1b) Referring to Range Object contained within a Worksheet Object
_1c ) Referring to a ( Application ? ) Range Object

The documentation is not perfectly clear on this, at least that is the opinion of much more VBA experienced people than me. So the following is partly my interpretation.( Especially _1c) ).
I would suggest we can get at a Range Object in three basic ways. I deliberately list things a bit in a jumbled order, as things in the “imaginary” world are often in a seemingly incorrect order.
_1c) Directly through some specific reference.
( http://excelmatters.com/referring-to-ranges-in-vba/#comment-197138 )
_1a) indirectly using the Cells Property ( Method ) already discussed. http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551484#post4551080 http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551484#post4551484
_1b) indirectly using a similar Property to that in _1a), which unfortunately someone in their wisdom decided to call the Range Property. This Range Property is a “way” or “Method like” thing and should not be confused with the final big “thing” of the Range Object.

_1a) 1b) The general typical Ideas given for referring to Range Objects in VBA.

Let’s say, I have defined Rng as a Range Object. Then this type of code ( used within the Excel Application in VBA code ): _..
_1a)(i) Rng=Worksheets(1).Cells(1, 1)
or
_1a)(i) Rng=Worksheets.Item(1).Cells(1, 1)
_.. is using the Cells Property of a Worksheet to return the Range Object of the first cell in the first Worksheet ( Index / Item Number 1 counting Worksheet Tabs from the left ).
The same again using a string name ( assuming the first Worksheets has the default English Excel name of “Sheet1” )
_1a)(i) Rng=Worksheets(“Sheet1”).Cells(1, 1)
or
_1a)(i) Rng=Worksheets.Item(“Sheet1”).Cells(1, 1)

Similarly the Range Property of the worksheet can be used
_1a)(ii) Rng=Worksheets(1).Range(“A1”)
or
_1a)(ii) Rng=Worksheets(“Sheet1”).Range(“A1”)
etc.. etc....

My experiments suggest the following is also acceptable for the same, and I am not sure if VBA may actually change _1a(ii) “internally” as it were, to this type of form
_1a)(iii) Rng=Worksheets(1).Range("='[MyFile.xlsm]Sheet1'!A1")
This last :1a)(iii) would still be using the Range Property of the worksheet. I think before and up to this point we are clearly using the Cells or Range Properties of a Worksheet. This last suggestion, _1a)(iii) , I am, in fact not too sure about and in end effect a Range Object must be returned, so this could be how VBA finally sees the final returned Range Object:-
_1b)(i) Rng=Application.Range("='[MyFile.xlsm]Sheet1'!A1")
This last one, I think, is a Range Object, but I am not too sure? We could have used this initially and hence , I think, possibly would have a more basic way of cell referencing with _1b)(i), that is to say explicitly referring to the Application Range. So finally we have _1c) Rng=Application.Range("='[MyFile.xlsm]Sheet1'!A1") ( A suggestion / proposal from me )

_._____________________________
A few further related concepts

Unqualified Range reference,
One sees most typically a shortened version, an “unqualified” Range reference, of this type of form
Rng=Range(“A1”)
This leads to uncertainties.
_A) Used within a Normal code module. The last code line above will default ( that is to say what VBA “sees” ) to this sort of form
_1b)(ii) Rng=Application.Range("='[" & ActiveWorkbook.Name & "]" & ActiveSheet.Name & "'!A1")
which is again, I think, a Range reference, possibly to be regarded as referencing explicitly or directly by a Range Object? So I think we are referring Explicitly through a Range Object.
We are defaulting here, in the case of the code line in a Normal Code module, to the Application Range and not to the Active Worksheets as often said.
It is possible that my idea of an Explicit reference through an Application Range Object could be called an Application Range Property, So I am touching on dodgy uncertain ground here.
Application Range Object *#*#*
http://www.mrexcel.com/forum/excel-questions/905371-selecting-range-different-worksheets-error.html#post4357003
http://excelmatters.com/referring-to-ranges-in-vba/#comment-197138
_B) Use of an “unqualified” Range reference for the instance of a Class Worksheets, that is to say put in, for example, the Worksheet code module of Worksheets(2), will default ( that is to say what VBA “sees” ) to this sort of form
_1a)(iii) Rng= Worksheets(2).Range("='[" & ActiveWorkbook.Name & "]" & Worksheets(2).Name & "'!A1")
Which I think is referring through a Range Property.

Range and Cells() ( and Item ) Properties of Ranges ( Range Range Property , Range Item Property ) and Range Cells Property )
We have been talking so far about the Range and Cells() Properties of Worksheets as well as my suggestion of an Application Range ( which we are leaving it uncertain currently as to whether it is an Application Range Object or Application Range Property *#*#* )
In any case we have finally in all cases a Range Object. Regardless of where this is, we have a further (a)(ii)) Range(“ “) and (a)(i)) Cells() Property!!!!!, of a form such as
Range(“A2”) and Cells(2, 1) , or pseudo like
Range(strAddress) and Cells(row_coordinate, column_coordinate)
Specifically here for the Range( ) case, we are limited to an Address string and not a full reference.
The Range and Cells() Properties of a worksheet we have seen extend from ( are referenced to ) the Top left of a Worksheet. Similarly, the Range and Cells() Properties of a Range Object extend from (are referenced to ) the Top left of the range Object. _...
_... For example:
_1c) Rng=Application.Range("=[Workbook]Worksheets(1)!A1").Range(strAddress)
Is applying the a Range Property to the Range Object from _1b)(i)
You can keep going infinitely with rng.Range.Range.Range.Range. Each Range Property returning a new modified Range Object to which the next Range property is applied.
For the case of a Range Object Range Property, negative numbers and negative column letters are not from the syntax allowed.
However for the case of the Range Object Cells() Property, negative co ordinates are permitted.. Note here however two things here:
Firstly, the Range Object will need to have its top left far enough away from the Worksheet Top left origin such that the negative co ordinate applied Cells() Property does not go “further back to the left” or “further back up” than the Spreadsheet boundaries; and secondly, zeros in such as this Property reference, Cells( 0, 0 ) , is also from the syntax valid. So For example, _..
Range("A2:C5").Cells(0, 1)
_.. will return finally the Range Object of the ( cell ) “box” at Address A1, ... ( We apply the Cells() Property to the top left cell of the range Object which is A2. O gives 1 row back up from row 2, and 1 gives the same column as column A )

( ......The Item Property: Many things in VBA can be referenced through a consecutive Item Number, or Index, like 1, 2, 3 ... etc. The order is determined in various ways for the different things. The typical syntax is then Item(Whole_Number) and is usually read only.
For the case of a Range Object, this number relates to each ( cell ) “box” in the Range Object. This ordering follows the typical Excel Spreadsheet ( cells ) “boxes” order convention of numbered from left to right and from top to bottom. We may use this to reference (cells) “boxes” outside the Range Object that lie within the Worksheet boundaries. These "Overshoot" Items follow further the row then column convention , effectively "duplicating down" the Worksheet, that is to say repeating the original Range Object vertically down the Worksheet )..
It is a further confusing aspect of the Range Object that for the Range Item Property we may also use two arguments in the ( ) bracket representing the row, and column. If this option is chosen then we can use Numbers or , for the columns , also the letter (wrapped in quotations). In the two argument case we extend beyond the original Range Object from the top left in the Original Range Object in the usual row, column way, ( we do not proceed in a duplicate type way in Ranges Objects stacked down the Worksheet ) .
!!!!!To complete the confusion_... there may be no Cells Property see next post......).
_..................................

What is all this Post about. ?
Two things really
_( One) 1a) 1b) ) A review of the more common ideas of Range Objects and Range and Cells() Properties, with a mind to going on to make a suggestion , or at least discussion on a , a possible Explicit-er Application Range Object ( or Application Range Property or even Application Range Method )_.. that is to say _1c) _..
_.. _( Two) 1c) ) The end result of all the above, is that I have got recently into always using variations of this type of way to reference a Range Object.

Sub strRefAppRngObj() ' http://www.excelforum.com/showthread.php?t=1154829&page=11&p=4551509&highlight=#post4551509
' 1c) Application Range Object
Dim strRef As String ' Prepares "Pointer" to a "Blue Print" (or Form, Questionnaire not yet filled in, a template etc.)"Pigeon Hole" in Memory, sufficient in construction to house a piece of Paper with code text giving the relevant information for the particular Variable Type. VBA is sent to it when it passes it. In a Routine it may be given a particular “Value”, or (“Values” for Objects). There instructions say then how to do that and handle(store) that(those). At Dim the created Paper is like a Blue Print that has some empty spaces not yet filled in. String is a a bit tricky. The Blue Print code line Paper in the Pigeon Hole will allow to note the string Length and an Initial start memory Location. This Location well have to change frequently as strings of different length are assigned. Instructiions will tell how to do this. Theoretically a specilal value vbNullString is set to aid in quick checks.. But...http://www.mrexcel.com/forum/excel-q...html#post44 '
Let strRef = "='[" & ThisWorkbook.Name & "]" & Worksheets.Item(1).Name & "'!A1:C3"
Dim Rng As Range ' EP Dim: For the Variable type declared, there should be some Blue Print or master Instruction list. If not The code will error at the start as it need to examine and therefore prepare for usage of the variable in the code run. The variable itself will go to some “Pigeon hole” that has a copy of the instructions or in some way has information on how to use the original instructions such that it can distinguish between different variables of the same type. When the code meets the variable it will look in the Pigeon Hole Pointer for instructions as to what to do in various situations. Knowing of the type allows in addition to get easily at the Methods and Properties through the applying of a period ( .Dot) ( intellisense ). Note this is a look up type list and may not be a guarantee that every offered thing is available – most will be typically.
Set Rng = Application.Range(strRef) ' EP Set: Setting to a Class will involve the use of an extra New at this code line. I will then have an Object referred to as an instance of a Class. At this point I include information on my Pointer Pigeon hole for a distinct distinguishable usage of an Object of the Class. For the case of something such as a Workbook this instancing has already been done, and in addition some values are filled in specific memory locations which are also held as part of the information in the Pigeon Hole Pointer. Wed will have a different Pointer for each instance. In most excel versions we already have a few instances of Worksheets. Such instances Objects can be further used., - For this a Dim to the class will be necessary, but the New must be omitted at Set. I can assign as many variables that I wish to the same existing instance
End Sub
Although the long string reference, strRef, looks daunting, I find this a robust way to reference a Range Object:
It gives me flexibility in the string build, and I have no confusion arising from where the code line might be... ( ... I reference the same Range Object, without generally any errors arising in the attempt, for the code line in any code Module )

Alan

' Rem Ref http://powerspreadsheets.com/excel-vba-range-object/

DocAElstein
10-28-2021, 11:56 AM
This is post #22047


Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023



Function and demo Codes to Demonstrate Range Item Property
Introduction, what is this post about? :
This Post explains some preliminary ideas that covers the basics behind putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string ( .Formula ( .Formula is the column letter and row number convention formula type ) ) to the Range Object to which the displayed cell obtains the value ( .Value ) it displays. ( So it ends up looking like this in the Spreadsheet http://imgur.com/k9IYFUj . For that example we will learn that in VBA we need to do something like this "=" & """""""" & "Hello from C3" & """""""" to put those values in )
The code of which the first half is described in this post, ( and shown in the next post http://www.excelforum.com/showthread.php?t=1154829&page=12&p=4555024#post4555024 is a demo code routine ( not a Function ) to illustrate the basic ideas behind the Function in the over over next posts. But it makes a good parallel alternative explanation of the
Range Item Property
The Range Item Property is used to return a single cell Range Object starting from the top left cell of a Range Object of one or more contiguous ( all there ) cells (More correctly said a Range Object of one or more Range Objects from a contiguous spreadsheet rectangular area ). It applies specifically to one area. ( A Range Object can be that of only one rectangular area of contiguous spreadsheet rectangular, but strictly speaking the first area , which mostly we talk about, is just one of many possible. Strictly speaking a Range Object is a collection of one or more Range Objects from a contiguous spreadsheet rectangular areas. Typically we use just one and when we use a code part like Rng. VBA assumes we meant to write Rng.Areas.Item(1). )
Range Item Property and Demo code description
The Range Item Property follows for two argument case the usual spreadsheet ( row_coordinate , column_coordinate ) convention starting from top left and going ( for positive coordinates ) “down” the “rows” and “across to the right” of columns.
For the single argument case, ( integer item number or integer index ) , the Range Item Property follows the usual all columns “across to the right” , then next row “down” convention.
Rem 1) The first few code lines use the Cells Property to return a Range Object of all the cells ( Range Objects ) in a Worksheet.
( Lines 50 – 70 shows how it comes about that we typically see a code line such as code line 70. I would suggest that is one of the main uses of the Cells Property http://www.excelforum.com/showthread.php?t=1154829&page=11#post4552374 http://www.excelforum.com/showthread.php?t=1154829&page=11#post4553399 )
Quotes in Excel VBA
As an aside we need to tackle this tricky theme, as a quick review will help make the following explanations and code lines a little less daunting.
http://www.excelfox.com/forum/showthread.php/1891-Multiple-Columns-Into-Single-Column-Using-Data-Text-To-Column/page2#post8836
http://www.mrexcel.com/forum/excel-questions/696820-quotes-visual-basic-applications.html#post4283381
http://www.excelfox.com/forum/showthread.php/2042-Special-concatenation?p=9517#post9517
http://www.eileenslounge.com/viewtopic.php?f=27&t=25298&p=196259#p196259
Our final goal in this sub section is to be able to confidentially put a formula string in a cell using VBA. That is to say ...putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value ( .Value ) it displays...( and doing that such that literal quotes appear within the final “seen” cell displayed text )

Display text in cell from text in Range Object .Value
Generally in VBA a start and a stop quote “ “ signal that what between is a String. So a code line like_..
Range(“A1”).Value = “Some Text”
_.. or code lines like
Dim strText As String
__ strText = "Some Text"
__ Range("A1").Value = strText
_..will recognise __ Some Text __ as a literal string and give the Range Object of the first cell that value, __ Some Text __ The .Value Property will become this string value by virtue of the ( write ) lines 100 and 110. ( The .Value Property is the Range Object value that is displayed by default in the spreadsheet cell ). This can also be seen clearly by stepping past ( F8 Debug mode code progression ) the code line 115 and hitting Ctrl+G to reveal in the Immediate ( Debug ) window, what the code line Debug.Print has “printed out” to that Window. ( The Immediate ( Debug ) Window is a help window available to us ) . The code Ws.Range("A1").Value has effectively read what is held in the Range Object of cell A1 for its .Value
( In line 140, we “write” via .Formula our string formula in column letter and row number notation type to the Range Object Property which houses those type of strings. That sounds reasonable. But using .Value will also work. I expect there is a parallel or the same thing going on there to when you manually write in a cell = ... after this Excel is expecting a formula and assigns appropriately the various values Properties, and then finally displays in the cell the .Value, and in the formula bar the .Formula )

Adding quotes to strings
To have a quote displayed requires generally within the string a double quote. If there is a strict theory to that then I expect very few people are privy to that. Two possible explanations I can think off are
_ the complier or similar simply looks inside text after a single quote for pairs and makes the appropriate addition in the held string
_ a syntax of a pair of quotes is always required and as such allowed. Effectively as in typical HTML type code these “start and stop “Tags”” signal that what within is a literal text. As such a pair like “” is valid ( and signals an empty string ) , a double quote within like “””” or ” “” “ is also valid syntax . Possibly there is some sort of confusion or uncertainty in what the complier actual sees here. Somehow I am going in and out of a literal string but at the same time joining them with a valid literal character of no length. Possibly somehow simultaneously two strings are seen but accompanying or applied to the same memory space, such as seeing the blue and purple in the following at the same point of zero length “ ““ “ . Having recognised a literal “ at “zero” length, it therefore joins the two sides of that text string with a single “ between at that point. This “ being added at point of zero length is like “inserting in” , which then somehow “shifts” appropriately, effectively adding 1 to the length ( Ref A.E. Jan 2016 )

Display text and quotes in cell from text in Range Object .Formula
Just taking the above one step further as this will also help in the understanding of the code routines discussed here. The Range Object can be given a formula, (with VBA as in Line 140) . (This typically is then seen displayed in the Formula bar). Writing manually in a cell = is recognised by Excel as indicating that what comes after is a formula. Text can be included in a formula, and the same convention is used as in VBA to indicate this by enclosing the text in a quote pair “ “. ( We would write manually like = "Some Text" ).
( _ .. At this point, in an attempt to help minimise the inevitable confusion that arises from the whole quotes theme, I use a general convention of
_ ..Blue font showing all VBA stuff which includes the quotes and ampersands used to build formula expressions
_ ..and
Green font showing what one actually would write in a spreadsheet cell and includes the literal quotes and ampersands needed to assign to the Range Object to get the final wanted result in the spreadsheet cell
_.. and Purple font showing what one needs to write ( in our discussions quote pairs ) differently within a VBA String in order to get something similar ( In our discussions a single quote ) in a String text written to a cell. For most normal simple characters and numbers ( in other words mostly non punctuation ) the color Purple translates directly to the color green , so will be shown in green to help the necessary different Purple more apparent.

In a spreadsheet one would manually write something of this form
="Some Text” or ="Some " & "Text" – Note here that I often include extra coupling through some redundant &s , as this helps constancy and compatibility / modifying and building strings.
In a string built in VBA to paste out to a cell we need to produce a string which internally looks like those_.
_. This would then take these forms in VBA code ( Lines 170 and 180 )
strText = "=" & """Some Text""" or strText = "=" & """Some “”" & "&" & """Text"""

Note: In a Range Object the formula String values, such as .Formula and the “value” String values are related. We may therefore assign out formula String, strText to either the Range Object .Formula or .Value. Regardless we will see displayed the Formula in the Formula bar, and the value, .Value, in the cell Some_Text_Formula_Value.JPG http://imgur.com/XVEzS7H

' '2b)(i)
It can be confusing to go finally to the case of a VBA string which will produce a final seen string value in a cell which may also include a quote. But really it is just a careful progression of the steps and ideas discussed thus far.
For example, say, we finally want this displayed in a cell
Some Text and a Quote "
But we want that to come from a formula ( as seen in the Formula bar )
Based on what we have disused thus far, we would need to write manually in the cell something of this form
=”Some Text and a Quote “ & “”””
One way to achieve this would be produce this String in VBA to be written to the Range Object of that cell
strText = "= " & """Some Text and a Quote """ & "&" & """"""""""
Once again for clarity here: That last line needs to produce the string in Debug.Print ( or as seen by hovering with the mouse over strText after the code has passed that line in debug, F8 mode ) which looks like we would manually write in the cell
Code lines in ' '2b)(i) take us through the above

Lines in ' '2b)(ii) follow a similar development to finally put a Formula into the Range Object of cell C3 to produce a simple test string displayed in the spreadsheet cell. HelloFromC3.JPG http://imgur.com/k9IYFUj
Note here: Lines 240 – 260 shows how it comes about that we typically see a code line such as code line 260 which I suggest gives the false idea of a Cells( ) Property which takes arguments. In fact I believe we are looking at the default Property of the Range Item Property applied to the first area Range Object of contiguous cells of the Range Object returned by the Cells Property. ( The Cells Property applied to a Worksheet can only return a single area of contiguous cells , but a Range Object is organised into a collection such areas of contiguous cells )



_.......
That covers the basics behind putting displayed text into a cell through using VBA to fill in the Formula of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value it displays. The reason for doing that will become apparent in the explanation of the second part of the code on the over next post is reviewed
_....

DocAElstein
10-28-2021, 11:56 AM
This is post #22048


Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023



Function and demo Codes to Demonstrate Range Item Property
Introduction, what is this post about? :
This Post explains some preliminary ideas that covers the basics behind putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string ( .Formula ( .Formula is the column letter and row number convention formula type ) ) to the Range Object to which the displayed cell obtains the value ( .Value ) it displays. ( So it ends up looking like this in the Spreadsheet http://imgur.com/k9IYFUj . For that example we will learn that in VBA we need to do something like this "=" & """""""" & "Hello from C3" & """""""" to put those values in )
The code of which the first half is described in this post, ( and shown in the next post http://www.excelforum.com/showthread.php?t=1154829&page=12&p=4555024#post4555024 is a demo code routine ( not a Function ) to illustrate the basic ideas behind the Function in the over over next posts. But it makes a good parallel alternative explanation of the
Range Item Property
The Range Item Property is used to return a single cell Range Object starting from the top left cell of a Range Object of one or more contiguous ( all there ) cells (More correctly said a Range Object of one or more Range Objects from a contiguous spreadsheet rectangular area ). It applies specifically to one area. ( A Range Object can be that of only one rectangular area of contiguous spreadsheet rectangular, but strictly speaking the first area , which mostly we talk about, is just one of many possible. Strictly speaking a Range Object is a collection of one or more Range Objects from a contiguous spreadsheet rectangular areas. Typically we use just one and when we use a code part like Rng. VBA assumes we meant to write Rng.Areas.Item(1). )
Range Item Property and Demo code description
The Range Item Property follows for two argument case the usual spreadsheet ( row_coordinate , column_coordinate ) convention starting from top left and going ( for positive coordinates ) “down” the “rows” and “across to the right” of columns.
For the single argument case, ( integer item number or integer index ) , the Range Item Property follows the usual all columns “across to the right” , then next row “down” convention.
Rem 1) The first few code lines use the Cells Property to return a Range Object of all the cells ( Range Objects ) in a Worksheet.
( Lines 50 – 70 shows how it comes about that we typically see a code line such as code line 70. I would suggest that is one of the main uses of the Cells Property http://www.excelforum.com/showthread.php?t=1154829&page=11#post4552374 http://www.excelforum.com/showthread.php?t=1154829&page=11#post4553399 )
Quotes in Excel VBA
As an aside we need to tackle this tricky theme, as a quick review will help make the following explanations and code lines a little less daunting.
http://www.excelfox.com/forum/showthread.php/1891-Multiple-Columns-Into-Single-Column-Using-Data-Text-To-Column/page2#post8836
http://www.mrexcel.com/forum/excel-questions/696820-quotes-visual-basic-applications.html#post4283381
http://www.excelfox.com/forum/showthread.php/2042-Special-concatenation?p=9517#post9517
http://www.eileenslounge.com/viewtopic.php?f=27&t=25298&p=196259#p196259
Our final goal in this sub section is to be able to confidentially put a formula string in a cell using VBA. That is to say ...putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value ( .Value ) it displays...( and doing that such that literal quotes appear within the final “seen” cell displayed text )

Display text in cell from text in Range Object .Value
Generally in VBA a start and a stop quote “ “ signal that what between is a String. So a code line like_..
Range(“A1”).Value = “Some Text”
_.. or code lines like
Dim strText As String
__ strText = "Some Text"
__ Range("A1").Value = strText
_..will recognise __ Some Text __ as a literal string and give the Range Object of the first cell that value, __ Some Text __ The .Value Property will become this string value by virtue of the ( write ) lines 100 and 110. ( The .Value Property is the Range Object value that is displayed by default in the spreadsheet cell ). This can also be seen clearly by stepping past ( F8 Debug mode code progression ) the code line 115 and hitting Ctrl+G to reveal in the Immediate ( Debug ) window, what the code line Debug.Print has “printed out” to that Window. ( The Immediate ( Debug ) Window is a help window available to us ) . The code Ws.Range("A1").Value has effectively read what is held in the Range Object of cell A1 for its .Value
( In line 140, we “write” via .Formula our string formula in column letter and row number notation type to the Range Object Property which houses those type of strings. That sounds reasonable. But using .Value will also work. I expect there is a parallel or the same thing going on there to when you manually write in a cell = ... after this Excel is expecting a formula and assigns appropriately the various values Properties, and then finally displays in the cell the .Value, and in the formula bar the .Formula )

Adding quotes to strings
To have a quote displayed requires generally within the string a double quote. If there is a strict theory to that then I expect very few people are privy to that. Two possible explanations I can think off are
_ the complier or similar simply looks inside text after a single quote for pairs and makes the appropriate addition in the held string
_ a syntax of a pair of quotes is always required and as such allowed. Effectively as in typical HTML type code these “start and stop “Tags”” signal that what within is a literal text. As such a pair like “” is valid ( and signals an empty string ) , a double quote within like “””” or ” “” “ is also valid syntax . Possibly there is some sort of confusion or uncertainty in what the complier actual sees here. Somehow I am going in and out of a literal string but at the same time joining them with a valid literal character of no length. Possibly somehow simultaneously two strings are seen but accompanying or applied to the same memory space, such as seeing the blue and purple in the following at the same point of zero length “ ““ “ . Having recognised a literal “ at “zero” length, it therefore joins the two sides of that text string with a single “ between at that point. This “ being added at point of zero length is like “inserting in” , which then somehow “shifts” appropriately, effectively adding 1 to the length ( Ref A.E. Jan 2016 )

Display text and quotes in cell from text in Range Object .Formula
Just taking the above one step further as this will also help in the understanding of the code routines discussed here. The Range Object can be given a formula, (with VBA as in Line 140) . (This typically is then seen displayed in the Formula bar). Writing manually in a cell = is recognised by Excel as indicating that what comes after is a formula. Text can be included in a formula, and the same convention is used as in VBA to indicate this by enclosing the text in a quote pair “ “. ( We would write manually like = "Some Text" ).
( _ .. At this point, in an attempt to help minimise the inevitable confusion that arises from the whole quotes theme, I use a general convention of
_ ..Blue font showing all VBA stuff which includes the quotes and ampersands used to build formula expressions
_ ..and
Green font showing what one actually would write in a spreadsheet cell and includes the literal quotes and ampersands needed to assign to the Range Object to get the final wanted result in the spreadsheet cell
_.. and Purple font showing what one needs to write ( in our discussions quote pairs ) differently within a VBA String in order to get something similar ( In our discussions a single quote ) in a String text written to a cell. For most normal simple characters and numbers ( in other words mostly non punctuation ) the color Purple translates directly to the color green , so will be shown in green to help the necessary different Purple more apparent.

In a spreadsheet one would manually write something of this form
="Some Text” or ="Some " & "Text" – Note here that I often include extra coupling through some redundant &s , as this helps constancy and compatibility / modifying and building strings.
In a string built in VBA to paste out to a cell we need to produce a string which internally looks like those_.
_. This would then take these forms in VBA code ( Lines 170 and 180 )
strText = "=" & """Some Text""" or strText = "=" & """Some “”" & "&" & """Text"""

Note: In a Range Object the formula String values, such as .Formula and the “value” String values are related. We may therefore assign out formula String, strText to either the Range Object .Formula or .Value. Regardless we will see displayed the Formula in the Formula bar, and the value, .Value, in the cell Some_Text_Formula_Value.JPG http://imgur.com/XVEzS7H

' '2b)(i)
It can be confusing to go finally to the case of a VBA string which will produce a final seen string value in a cell which may also include a quote. But really it is just a careful progression of the steps and ideas discussed thus far.
For example, say, we finally want this displayed in a cell
Some Text and a Quote "
But we want that to come from a formula ( as seen in the Formula bar )
Based on what we have disused thus far, we would need to write manually in the cell something of this form
=”Some Text and a Quote “ & “”””
One way to achieve this would be produce this String in VBA to be written to the Range Object of that cell
strText = "= " & """Some Text and a Quote """ & "&" & """"""""""
Once again for clarity here: That last line needs to produce the string in Debug.Print ( or as seen by hovering with the mouse over strText after the code has passed that line in debug, F8 mode ) which looks like we would manually write in the cell
Code lines in ' '2b)(i) take us through the above

Lines in ' '2b)(ii) follow a similar development to finally put a Formula into the Range Object of cell C3 to produce a simple test string displayed in the spreadsheet cell. HelloFromC3.JPG http://imgur.com/k9IYFUj
Note here: Lines 240 – 260 shows how it comes about that we typically see a code line such as code line 260 which I suggest gives the false idea of a Cells( ) Property which takes arguments. In fact I believe we are looking at the default Property of the Range Item Property applied to the first area Range Object of contiguous cells of the Range Object returned by the Cells Property. ( The Cells Property applied to a Worksheet can only return a single area of contiguous cells , but a Range Object is organised into a collection such areas of contiguous cells )



_.......
That covers the basics behind putting displayed text into a cell through using VBA to fill in the Formula of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value it displays. The reason for doing that will become apparent in the explanation of the second part of the code on the over next post is reviewed
_....

DocAElstein
10-28-2021, 11:56 AM
This is post #22049


Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023



Function and demo Codes to Demonstrate Range Item Property
Introduction, what is this post about? :
This Post explains some preliminary ideas that covers the basics behind putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string ( .Formula ( .Formula is the column letter and row number convention formula type ) ) to the Range Object to which the displayed cell obtains the value ( .Value ) it displays. ( So it ends up looking like this in the Spreadsheet http://imgur.com/k9IYFUj . For that example we will learn that in VBA we need to do something like this "=" & """""""" & "Hello from C3" & """""""" to put those values in )
The code of which the first half is described in this post, ( and shown in the next post http://www.excelforum.com/showthread.php?t=1154829&page=12&p=4555024#post4555024 is a demo code routine ( not a Function ) to illustrate the basic ideas behind the Function in the over over next posts. But it makes a good parallel alternative explanation of the
Range Item Property
The Range Item Property is used to return a single cell Range Object starting from the top left cell of a Range Object of one or more contiguous ( all there ) cells (More correctly said a Range Object of one or more Range Objects from a contiguous spreadsheet rectangular area ). It applies specifically to one area. ( A Range Object can be that of only one rectangular area of contiguous spreadsheet rectangular, but strictly speaking the first area , which mostly we talk about, is just one of many possible. Strictly speaking a Range Object is a collection of one or more Range Objects from a contiguous spreadsheet rectangular areas. Typically we use just one and when we use a code part like Rng. VBA assumes we meant to write Rng.Areas.Item(1). )
Range Item Property and Demo code description
The Range Item Property follows for two argument case the usual spreadsheet ( row_coordinate , column_coordinate ) convention starting from top left and going ( for positive coordinates ) “down” the “rows” and “across to the right” of columns.
For the single argument case, ( integer item number or integer index ) , the Range Item Property follows the usual all columns “across to the right” , then next row “down” convention.
Rem 1) The first few code lines use the Cells Property to return a Range Object of all the cells ( Range Objects ) in a Worksheet.
( Lines 50 – 70 shows how it comes about that we typically see a code line such as code line 70. I would suggest that is one of the main uses of the Cells Property http://www.excelforum.com/showthread.php?t=1154829&page=11#post4552374 http://www.excelforum.com/showthread.php?t=1154829&page=11#post4553399 )
Quotes in Excel VBA
As an aside we need to tackle this tricky theme, as a quick review will help make the following explanations and code lines a little less daunting.
http://www.excelfox.com/forum/showthread.php/1891-Multiple-Columns-Into-Single-Column-Using-Data-Text-To-Column/page2#post8836
http://www.mrexcel.com/forum/excel-questions/696820-quotes-visual-basic-applications.html#post4283381
http://www.excelfox.com/forum/showthread.php/2042-Special-concatenation?p=9517#post9517
http://www.eileenslounge.com/viewtopic.php?f=27&t=25298&p=196259#p196259
Our final goal in this sub section is to be able to confidentially put a formula string in a cell using VBA. That is to say ...putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value ( .Value ) it displays...( and doing that such that literal quotes appear within the final “seen” cell displayed text )

Display text in cell from text in Range Object .Value
Generally in VBA a start and a stop quote “ “ signal that what between is a String. So a code line like_..
Range(“A1”).Value = “Some Text”
_.. or code lines like
Dim strText As String
__ strText = "Some Text"
__ Range("A1").Value = strText
_..will recognise __ Some Text __ as a literal string and give the Range Object of the first cell that value, __ Some Text __ The .Value Property will become this string value by virtue of the ( write ) lines 100 and 110. ( The .Value Property is the Range Object value that is displayed by default in the spreadsheet cell ). This can also be seen clearly by stepping past ( F8 Debug mode code progression ) the code line 115 and hitting Ctrl+G to reveal in the Immediate ( Debug ) window, what the code line Debug.Print has “printed out” to that Window. ( The Immediate ( Debug ) Window is a help window available to us ) . The code Ws.Range("A1").Value has effectively read what is held in the Range Object of cell A1 for its .Value
( In line 140, we “write” via .Formula our string formula in column letter and row number notation type to the Range Object Property which houses those type of strings. That sounds reasonable. But using .Value will also work. I expect there is a parallel or the same thing going on there to when you manually write in a cell = ... after this Excel is expecting a formula and assigns appropriately the various values Properties, and then finally displays in the cell the .Value, and in the formula bar the .Formula )

Adding quotes to strings
To have a quote displayed requires generally within the string a double quote. If there is a strict theory to that then I expect very few people are privy to that. Two possible explanations I can think off are
_ the complier or similar simply looks inside text after a single quote for pairs and makes the appropriate addition in the held string
_ a syntax of a pair of quotes is always required and as such allowed. Effectively as in typical HTML type code these “start and stop “Tags”” signal that what within is a literal text. As such a pair like “” is valid ( and signals an empty string ) , a double quote within like “””” or ” “” “ is also valid syntax . Possibly there is some sort of confusion or uncertainty in what the complier actual sees here. Somehow I am going in and out of a literal string but at the same time joining them with a valid literal character of no length. Possibly somehow simultaneously two strings are seen but accompanying or applied to the same memory space, such as seeing the blue and purple in the following at the same point of zero length “ ““ “ . Having recognised a literal “ at “zero” length, it therefore joins the two sides of that text string with a single “ between at that point. This “ being added at point of zero length is like “inserting in” , which then somehow “shifts” appropriately, effectively adding 1 to the length ( Ref A.E. Jan 2016 )

Display text and quotes in cell from text in Range Object .Formula
Just taking the above one step further as this will also help in the understanding of the code routines discussed here. The Range Object can be given a formula, (with VBA as in Line 140) . (This typically is then seen displayed in the Formula bar). Writing manually in a cell = is recognised by Excel as indicating that what comes after is a formula. Text can be included in a formula, and the same convention is used as in VBA to indicate this by enclosing the text in a quote pair “ “. ( We would write manually like = "Some Text" ).
( _ .. At this point, in an attempt to help minimise the inevitable confusion that arises from the whole quotes theme, I use a general convention of
_ ..Blue font showing all VBA stuff which includes the quotes and ampersands used to build formula expressions
_ ..and
Green font showing what one actually would write in a spreadsheet cell and includes the literal quotes and ampersands needed to assign to the Range Object to get the final wanted result in the spreadsheet cell
_.. and Purple font showing what one needs to write ( in our discussions quote pairs ) differently within a VBA String in order to get something similar ( In our discussions a single quote ) in a String text written to a cell. For most normal simple characters and numbers ( in other words mostly non punctuation ) the color Purple translates directly to the color green , so will be shown in green to help the necessary different Purple more apparent.

In a spreadsheet one would manually write something of this form
="Some Text” or ="Some " & "Text" – Note here that I often include extra coupling through some redundant &s , as this helps constancy and compatibility / modifying and building strings.
In a string built in VBA to paste out to a cell we need to produce a string which internally looks like those_.
_. This would then take these forms in VBA code ( Lines 170 and 180 )
strText = "=" & """Some Text""" or strText = "=" & """Some “”" & "&" & """Text"""

Note: In a Range Object the formula String values, such as .Formula and the “value” String values are related. We may therefore assign out formula String, strText to either the Range Object .Formula or .Value. Regardless we will see displayed the Formula in the Formula bar, and the value, .Value, in the cell Some_Text_Formula_Value.JPG http://imgur.com/XVEzS7H

' '2b)(i)
It can be confusing to go finally to the case of a VBA string which will produce a final seen string value in a cell which may also include a quote. But really it is just a careful progression of the steps and ideas discussed thus far.
For example, say, we finally want this displayed in a cell
Some Text and a Quote "
But we want that to come from a formula ( as seen in the Formula bar )
Based on what we have disused thus far, we would need to write manually in the cell something of this form
=”Some Text and a Quote “ & “”””
One way to achieve this would be produce this String in VBA to be written to the Range Object of that cell
strText = "= " & """Some Text and a Quote """ & "&" & """"""""""
Once again for clarity here: That last line needs to produce the string in Debug.Print ( or as seen by hovering with the mouse over strText after the code has passed that line in debug, F8 mode ) which looks like we would manually write in the cell
Code lines in ' '2b)(i) take us through the above

Lines in ' '2b)(ii) follow a similar development to finally put a Formula into the Range Object of cell C3 to produce a simple test string displayed in the spreadsheet cell. HelloFromC3.JPG http://imgur.com/k9IYFUj
Note here: Lines 240 – 260 shows how it comes about that we typically see a code line such as code line 260 which I suggest gives the false idea of a Cells( ) Property which takes arguments. In fact I believe we are looking at the default Property of the Range Item Property applied to the first area Range Object of contiguous cells of the Range Object returned by the Cells Property. ( The Cells Property applied to a Worksheet can only return a single area of contiguous cells , but a Range Object is organised into a collection such areas of contiguous cells )



_.......
That covers the basics behind putting displayed text into a cell through using VBA to fill in the Formula of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value it displays. The reason for doing that will become apparent in the explanation of the second part of the code on the over next post is reviewed
_....

DocAElstein
10-28-2021, 11:56 AM
This is post #22068


Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023



Function and demo Codes to Demonstrate Range Item Property
Introduction, what is this post about? :
This Post explains some preliminary ideas that covers the basics behind putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string ( .Formula ( .Formula is the column letter and row number convention formula type ) ) to the Range Object to which the displayed cell obtains the value ( .Value ) it displays. ( So it ends up looking like this in the Spreadsheet http://imgur.com/k9IYFUj . For that example we will learn that in VBA we need to do something like this "=" & """""""" & "Hello from C3" & """""""" to put those values in )
The code of which the first half is described in this post, ( and shown in the next post http://www.excelforum.com/showthread.php?t=1154829&page=12&p=4555024#post4555024 is a demo code routine ( not a Function ) to illustrate the basic ideas behind the Function in the over over next posts. But it makes a good parallel alternative explanation of the
Range Item Property
The Range Item Property is used to return a single cell Range Object starting from the top left cell of a Range Object of one or more contiguous ( all there ) cells (More correctly said a Range Object of one or more Range Objects from a contiguous spreadsheet rectangular area ). It applies specifically to one area. ( A Range Object can be that of only one rectangular area of contiguous spreadsheet rectangular, but strictly speaking the first area , which mostly we talk about, is just one of many possible. Strictly speaking a Range Object is a collection of one or more Range Objects from a contiguous spreadsheet rectangular areas. Typically we use just one and when we use a code part like Rng. VBA assumes we meant to write Rng.Areas.Item(1). )
Range Item Property and Demo code description
The Range Item Property follows for two argument case the usual spreadsheet ( row_coordinate , column_coordinate ) convention starting from top left and going ( for positive coordinates ) “down” the “rows” and “across to the right” of columns.
For the single argument case, ( integer item number or integer index ) , the Range Item Property follows the usual all columns “across to the right” , then next row “down” convention.
Rem 1) The first few code lines use the Cells Property to return a Range Object of all the cells ( Range Objects ) in a Worksheet.
( Lines 50 – 70 shows how it comes about that we typically see a code line such as code line 70. I would suggest that is one of the main uses of the Cells Property http://www.excelforum.com/showthread.php?t=1154829&page=11#post4552374 http://www.excelforum.com/showthread.php?t=1154829&page=11#post4553399 )
Quotes in Excel VBA
As an aside we need to tackle this tricky theme, as a quick review will help make the following explanations and code lines a little less daunting.
http://www.excelfox.com/forum/showthread.php/1891-Multiple-Columns-Into-Single-Column-Using-Data-Text-To-Column/page2#post8836
http://www.mrexcel.com/forum/excel-questions/696820-quotes-visual-basic-applications.html#post4283381
http://www.excelfox.com/forum/showthread.php/2042-Special-concatenation?p=9517#post9517
http://www.eileenslounge.com/viewtopic.php?f=27&t=25298&p=196259#p196259
Our final goal in this sub section is to be able to confidentially put a formula string in a cell using VBA. That is to say ...putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value ( .Value ) it displays...( and doing that such that literal quotes appear within the final “seen” cell displayed text )

Display text in cell from text in Range Object .Value
Generally in VBA a start and a stop quote “ “ signal that what between is a String. So a code line like_..
Range(“A1”).Value = “Some Text”
_.. or code lines like
Dim strText As String
__ strText = "Some Text"
__ Range("A1").Value = strText
_..will recognise __ Some Text __ as a literal string and give the Range Object of the first cell that value, __ Some Text __ The .Value Property will become this string value by virtue of the ( write ) lines 100 and 110. ( The .Value Property is the Range Object value that is displayed by default in the spreadsheet cell ). This can also be seen clearly by stepping past ( F8 Debug mode code progression ) the code line 115 and hitting Ctrl+G to reveal in the Immediate ( Debug ) window, what the code line Debug.Print has “printed out” to that Window. ( The Immediate ( Debug ) Window is a help window available to us ) . The code Ws.Range("A1").Value has effectively read what is held in the Range Object of cell A1 for its .Value
( In line 140, we “write” via .Formula our string formula in column letter and row number notation type to the Range Object Property which houses those type of strings. That sounds reasonable. But using .Value will also work. I expect there is a parallel or the same thing going on there to when you manually write in a cell = ... after this Excel is expecting a formula and assigns appropriately the various values Properties, and then finally displays in the cell the .Value, and in the formula bar the .Formula )

Adding quotes to strings
To have a quote displayed requires generally within the string a double quote. If there is a strict theory to that then I expect very few people are privy to that. Two possible explanations I can think off are
_ the complier or similar simply looks inside text after a single quote for pairs and makes the appropriate addition in the held string
_ a syntax of a pair of quotes is always required and as such allowed. Effectively as in typical HTML type code these “start and stop “Tags”” signal that what within is a literal text. As such a pair like “” is valid ( and signals an empty string ) , a double quote within like “””” or ” “” “ is also valid syntax . Possibly there is some sort of confusion or uncertainty in what the complier actual sees here. Somehow I am going in and out of a literal string but at the same time joining them with a valid literal character of no length. Possibly somehow simultaneously two strings are seen but accompanying or applied to the same memory space, such as seeing the blue and purple in the following at the same point of zero length “ ““ “ . Having recognised a literal “ at “zero” length, it therefore joins the two sides of that text string with a single “ between at that point. This “ being added at point of zero length is like “inserting in” , which then somehow “shifts” appropriately, effectively adding 1 to the length ( Ref A.E. Jan 2016 )

Display text and quotes in cell from text in Range Object .Formula
Just taking the above one step further as this will also help in the understanding of the code routines discussed here. The Range Object can be given a formula, (with VBA as in Line 140) . (This typically is then seen displayed in the Formula bar). Writing manually in a cell = is recognised by Excel as indicating that what comes after is a formula. Text can be included in a formula, and the same convention is used as in VBA to indicate this by enclosing the text in a quote pair “ “. ( We would write manually like = "Some Text" ).
( _ .. At this point, in an attempt to help minimise the inevitable confusion that arises from the whole quotes theme, I use a general convention of
_ ..Blue font showing all VBA stuff which includes the quotes and ampersands used to build formula expressions
_ ..and
Green font showing what one actually would write in a spreadsheet cell and includes the literal quotes and ampersands needed to assign to the Range Object to get the final wanted result in the spreadsheet cell
_.. and Purple font showing what one needs to write ( in our discussions quote pairs ) differently within a VBA String in order to get something similar ( In our discussions a single quote ) in a String text written to a cell. For most normal simple characters and numbers ( in other words mostly non punctuation ) the color Purple translates directly to the color green , so will be shown in green to help the necessary different Purple more apparent.

In a spreadsheet one would manually write something of this form
="Some Text” or ="Some " & "Text" – Note here that I often include extra coupling through some redundant &s , as this helps constancy and compatibility / modifying and building strings.
In a string built in VBA to paste out to a cell we need to produce a string which internally looks like those_.
_. This would then take these forms in VBA code ( Lines 170 and 180 )
strText = "=" & """Some Text""" or strText = "=" & """Some “”" & "&" & """Text"""

Note: In a Range Object the formula String values, such as .Formula and the “value” String values are related. We may therefore assign out formula String, strText to either the Range Object .Formula or .Value. Regardless we will see displayed the Formula in the Formula bar, and the value, .Value, in the cell Some_Text_Formula_Value.JPG http://imgur.com/XVEzS7H

' '2b)(i)
It can be confusing to go finally to the case of a VBA string which will produce a final seen string value in a cell which may also include a quote. But really it is just a careful progression of the steps and ideas discussed thus far.
For example, say, we finally want this displayed in a cell
Some Text and a Quote "
But we want that to come from a formula ( as seen in the Formula bar )
Based on what we have disused thus far, we would need to write manually in the cell something of this form
=”Some Text and a Quote “ & “”””
One way to achieve this would be produce this String in VBA to be written to the Range Object of that cell
strText = "= " & """Some Text and a Quote """ & "&" & """"""""""
Once again for clarity here: That last line needs to produce the string in Debug.Print ( or as seen by hovering with the mouse over strText after the code has passed that line in debug, F8 mode ) which looks like we would manually write in the cell
Code lines in ' '2b)(i) take us through the above

Lines in ' '2b)(ii) follow a similar development to finally put a Formula into the Range Object of cell C3 to produce a simple test string displayed in the spreadsheet cell. HelloFromC3.JPG http://imgur.com/k9IYFUj
Note here: Lines 240 – 260 shows how it comes about that we typically see a code line such as code line 260 which I suggest gives the false idea of a Cells( ) Property which takes arguments. In fact I believe we are looking at the default Property of the Range Item Property applied to the first area Range Object of contiguous cells of the Range Object returned by the Cells Property. ( The Cells Property applied to a Worksheet can only return a single area of contiguous cells , but a Range Object is organised into a collection such areas of contiguous cells )



_.......
That covers the basics behind putting displayed text into a cell through using VBA to fill in the Formula of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value it displays. The reason for doing that will become apparent in the explanation of the second part of the code on the over next post is reviewed
_....

DocAElstein
10-28-2021, 11:56 AM
This is post #22069


Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023



Function and demo Codes to Demonstrate Range Item Property
Introduction, what is this post about? :
This Post explains some preliminary ideas that covers the basics behind putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string ( .Formula ( .Formula is the column letter and row number convention formula type ) ) to the Range Object to which the displayed cell obtains the value ( .Value ) it displays. ( So it ends up looking like this in the Spreadsheet http://imgur.com/k9IYFUj . For that example we will learn that in VBA we need to do something like this "=" & """""""" & "Hello from C3" & """""""" to put those values in )
The code of which the first half is described in this post, ( and shown in the next post http://www.excelforum.com/showthread.php?t=1154829&page=12&p=4555024#post4555024 is a demo code routine ( not a Function ) to illustrate the basic ideas behind the Function in the over over next posts. But it makes a good parallel alternative explanation of the
Range Item Property
The Range Item Property is used to return a single cell Range Object starting from the top left cell of a Range Object of one or more contiguous ( all there ) cells (More correctly said a Range Object of one or more Range Objects from a contiguous spreadsheet rectangular area ). It applies specifically to one area. ( A Range Object can be that of only one rectangular area of contiguous spreadsheet rectangular, but strictly speaking the first area , which mostly we talk about, is just one of many possible. Strictly speaking a Range Object is a collection of one or more Range Objects from a contiguous spreadsheet rectangular areas. Typically we use just one and when we use a code part like Rng. VBA assumes we meant to write Rng.Areas.Item(1). )
Range Item Property and Demo code description
The Range Item Property follows for two argument case the usual spreadsheet ( row_coordinate , column_coordinate ) convention starting from top left and going ( for positive coordinates ) “down” the “rows” and “across to the right” of columns.
For the single argument case, ( integer item number or integer index ) , the Range Item Property follows the usual all columns “across to the right” , then next row “down” convention.
Rem 1) The first few code lines use the Cells Property to return a Range Object of all the cells ( Range Objects ) in a Worksheet.
( Lines 50 – 70 shows how it comes about that we typically see a code line such as code line 70. I would suggest that is one of the main uses of the Cells Property http://www.excelforum.com/showthread.php?t=1154829&page=11#post4552374 http://www.excelforum.com/showthread.php?t=1154829&page=11#post4553399 )
Quotes in Excel VBA
As an aside we need to tackle this tricky theme, as a quick review will help make the following explanations and code lines a little less daunting.
http://www.excelfox.com/forum/showthread.php/1891-Multiple-Columns-Into-Single-Column-Using-Data-Text-To-Column/page2#post8836
http://www.mrexcel.com/forum/excel-questions/696820-quotes-visual-basic-applications.html#post4283381
http://www.excelfox.com/forum/showthread.php/2042-Special-concatenation?p=9517#post9517
http://www.eileenslounge.com/viewtopic.php?f=27&t=25298&p=196259#p196259
Our final goal in this sub section is to be able to confidentially put a formula string in a cell using VBA. That is to say ...putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value ( .Value ) it displays...( and doing that such that literal quotes appear within the final “seen” cell displayed text )

Display text in cell from text in Range Object .Value
Generally in VBA a start and a stop quote “ “ signal that what between is a String. So a code line like_..
Range(“A1”).Value = “Some Text”
_.. or code lines like
Dim strText As String
__ strText = "Some Text"
__ Range("A1").Value = strText
_..will recognise __ Some Text __ as a literal string and give the Range Object of the first cell that value, __ Some Text __ The .Value Property will become this string value by virtue of the ( write ) lines 100 and 110. ( The .Value Property is the Range Object value that is displayed by default in the spreadsheet cell ). This can also be seen clearly by stepping past ( F8 Debug mode code progression ) the code line 115 and hitting Ctrl+G to reveal in the Immediate ( Debug ) window, what the code line Debug.Print has “printed out” to that Window. ( The Immediate ( Debug ) Window is a help window available to us ) . The code Ws.Range("A1").Value has effectively read what is held in the Range Object of cell A1 for its .Value
( In line 140, we “write” via .Formula our string formula in column letter and row number notation type to the Range Object Property which houses those type of strings. That sounds reasonable. But using .Value will also work. I expect there is a parallel or the same thing going on there to when you manually write in a cell = ... after this Excel is expecting a formula and assigns appropriately the various values Properties, and then finally displays in the cell the .Value, and in the formula bar the .Formula )

Adding quotes to strings
To have a quote displayed requires generally within the string a double quote. If there is a strict theory to that then I expect very few people are privy to that. Two possible explanations I can think off are
_ the complier or similar simply looks inside text after a single quote for pairs and makes the appropriate addition in the held string
_ a syntax of a pair of quotes is always required and as such allowed. Effectively as in typical HTML type code these “start and stop “Tags”” signal that what within is a literal text. As such a pair like “” is valid ( and signals an empty string ) , a double quote within like “””” or ” “” “ is also valid syntax . Possibly there is some sort of confusion or uncertainty in what the complier actual sees here. Somehow I am going in and out of a literal string but at the same time joining them with a valid literal character of no length. Possibly somehow simultaneously two strings are seen but accompanying or applied to the same memory space, such as seeing the blue and purple in the following at the same point of zero length “ ““ “ . Having recognised a literal “ at “zero” length, it therefore joins the two sides of that text string with a single “ between at that point. This “ being added at point of zero length is like “inserting in” , which then somehow “shifts” appropriately, effectively adding 1 to the length ( Ref A.E. Jan 2016 )

Display text and quotes in cell from text in Range Object .Formula
Just taking the above one step further as this will also help in the understanding of the code routines discussed here. The Range Object can be given a formula, (with VBA as in Line 140) . (This typically is then seen displayed in the Formula bar). Writing manually in a cell = is recognised by Excel as indicating that what comes after is a formula. Text can be included in a formula, and the same convention is used as in VBA to indicate this by enclosing the text in a quote pair “ “. ( We would write manually like = "Some Text" ).
( _ .. At this point, in an attempt to help minimise the inevitable confusion that arises from the whole quotes theme, I use a general convention of
_ ..Blue font showing all VBA stuff which includes the quotes and ampersands used to build formula expressions
_ ..and
Green font showing what one actually would write in a spreadsheet cell and includes the literal quotes and ampersands needed to assign to the Range Object to get the final wanted result in the spreadsheet cell
_.. and Purple font showing what one needs to write ( in our discussions quote pairs ) differently within a VBA String in order to get something similar ( In our discussions a single quote ) in a String text written to a cell. For most normal simple characters and numbers ( in other words mostly non punctuation ) the color Purple translates directly to the color green , so will be shown in green to help the necessary different Purple more apparent.

In a spreadsheet one would manually write something of this form
="Some Text” or ="Some " & "Text" – Note here that I often include extra coupling through some redundant &s , as this helps constancy and compatibility / modifying and building strings.
In a string built in VBA to paste out to a cell we need to produce a string which internally looks like those_.
_. This would then take these forms in VBA code ( Lines 170 and 180 )
strText = "=" & """Some Text""" or strText = "=" & """Some “”" & "&" & """Text"""

Note: In a Range Object the formula String values, such as .Formula and the “value” String values are related. We may therefore assign out formula String, strText to either the Range Object .Formula or .Value. Regardless we will see displayed the Formula in the Formula bar, and the value, .Value, in the cell Some_Text_Formula_Value.JPG http://imgur.com/XVEzS7H

' '2b)(i)
It can be confusing to go finally to the case of a VBA string which will produce a final seen string value in a cell which may also include a quote. But really it is just a careful progression of the steps and ideas discussed thus far.
For example, say, we finally want this displayed in a cell
Some Text and a Quote "
But we want that to come from a formula ( as seen in the Formula bar )
Based on what we have disused thus far, we would need to write manually in the cell something of this form
=”Some Text and a Quote “ & “”””
One way to achieve this would be produce this String in VBA to be written to the Range Object of that cell
strText = "= " & """Some Text and a Quote """ & "&" & """"""""""
Once again for clarity here: That last line needs to produce the string in Debug.Print ( or as seen by hovering with the mouse over strText after the code has passed that line in debug, F8 mode ) which looks like we would manually write in the cell
Code lines in ' '2b)(i) take us through the above

Lines in ' '2b)(ii) follow a similar development to finally put a Formula into the Range Object of cell C3 to produce a simple test string displayed in the spreadsheet cell. HelloFromC3.JPG http://imgur.com/k9IYFUj
Note here: Lines 240 – 260 shows how it comes about that we typically see a code line such as code line 260 which I suggest gives the false idea of a Cells( ) Property which takes arguments. In fact I believe we are looking at the default Property of the Range Item Property applied to the first area Range Object of contiguous cells of the Range Object returned by the Cells Property. ( The Cells Property applied to a Worksheet can only return a single area of contiguous cells , but a Range Object is organised into a collection such areas of contiguous cells )



_.......
That covers the basics behind putting displayed text into a cell through using VBA to fill in the Formula of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value it displays. The reason for doing that will become apparent in the explanation of the second part of the code on the over next post is reviewed
_....

DocAElstein
10-28-2021, 11:56 AM
This is post #22070


Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023



Function and demo Codes to Demonstrate Range Item Property
Introduction, what is this post about? :
This Post explains some preliminary ideas that covers the basics behind putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string ( .Formula ( .Formula is the column letter and row number convention formula type ) ) to the Range Object to which the displayed cell obtains the value ( .Value ) it displays. ( So it ends up looking like this in the Spreadsheet http://imgur.com/k9IYFUj . For that example we will learn that in VBA we need to do something like this "=" & """""""" & "Hello from C3" & """""""" to put those values in )
The code of which the first half is described in this post, ( and shown in the next post http://www.excelforum.com/showthread.php?t=1154829&page=12&p=4555024#post4555024 is a demo code routine ( not a Function ) to illustrate the basic ideas behind the Function in the over over next posts. But it makes a good parallel alternative explanation of the
Range Item Property
The Range Item Property is used to return a single cell Range Object starting from the top left cell of a Range Object of one or more contiguous ( all there ) cells (More correctly said a Range Object of one or more Range Objects from a contiguous spreadsheet rectangular area ). It applies specifically to one area. ( A Range Object can be that of only one rectangular area of contiguous spreadsheet rectangular, but strictly speaking the first area , which mostly we talk about, is just one of many possible. Strictly speaking a Range Object is a collection of one or more Range Objects from a contiguous spreadsheet rectangular areas. Typically we use just one and when we use a code part like Rng. VBA assumes we meant to write Rng.Areas.Item(1). )
Range Item Property and Demo code description
The Range Item Property follows for two argument case the usual spreadsheet ( row_coordinate , column_coordinate ) convention starting from top left and going ( for positive coordinates ) “down” the “rows” and “across to the right” of columns.
For the single argument case, ( integer item number or integer index ) , the Range Item Property follows the usual all columns “across to the right” , then next row “down” convention.
Rem 1) The first few code lines use the Cells Property to return a Range Object of all the cells ( Range Objects ) in a Worksheet.
( Lines 50 – 70 shows how it comes about that we typically see a code line such as code line 70. I would suggest that is one of the main uses of the Cells Property http://www.excelforum.com/showthread.php?t=1154829&page=11#post4552374 http://www.excelforum.com/showthread.php?t=1154829&page=11#post4553399 )
Quotes in Excel VBA
As an aside we need to tackle this tricky theme, as a quick review will help make the following explanations and code lines a little less daunting.
http://www.excelfox.com/forum/showthread.php/1891-Multiple-Columns-Into-Single-Column-Using-Data-Text-To-Column/page2#post8836
http://www.mrexcel.com/forum/excel-questions/696820-quotes-visual-basic-applications.html#post4283381
http://www.excelfox.com/forum/showthread.php/2042-Special-concatenation?p=9517#post9517
http://www.eileenslounge.com/viewtopic.php?f=27&t=25298&p=196259#p196259
Our final goal in this sub section is to be able to confidentially put a formula string in a cell using VBA. That is to say ...putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value ( .Value ) it displays...( and doing that such that literal quotes appear within the final “seen” cell displayed text )

Display text in cell from text in Range Object .Value
Generally in VBA a start and a stop quote “ “ signal that what between is a String. So a code line like_..
Range(“A1”).Value = “Some Text”
_.. or code lines like
Dim strText As String
__ strText = "Some Text"
__ Range("A1").Value = strText
_..will recognise __ Some Text __ as a literal string and give the Range Object of the first cell that value, __ Some Text __ The .Value Property will become this string value by virtue of the ( write ) lines 100 and 110. ( The .Value Property is the Range Object value that is displayed by default in the spreadsheet cell ). This can also be seen clearly by stepping past ( F8 Debug mode code progression ) the code line 115 and hitting Ctrl+G to reveal in the Immediate ( Debug ) window, what the code line Debug.Print has “printed out” to that Window. ( The Immediate ( Debug ) Window is a help window available to us ) . The code Ws.Range("A1").Value has effectively read what is held in the Range Object of cell A1 for its .Value
( In line 140, we “write” via .Formula our string formula in column letter and row number notation type to the Range Object Property which houses those type of strings. That sounds reasonable. But using .Value will also work. I expect there is a parallel or the same thing going on there to when you manually write in a cell = ... after this Excel is expecting a formula and assigns appropriately the various values Properties, and then finally displays in the cell the .Value, and in the formula bar the .Formula )

Adding quotes to strings
To have a quote displayed requires generally within the string a double quote. If there is a strict theory to that then I expect very few people are privy to that. Two possible explanations I can think off are
_ the complier or similar simply looks inside text after a single quote for pairs and makes the appropriate addition in the held string
_ a syntax of a pair of quotes is always required and as such allowed. Effectively as in typical HTML type code these “start and stop “Tags”” signal that what within is a literal text. As such a pair like “” is valid ( and signals an empty string ) , a double quote within like “””” or ” “” “ is also valid syntax . Possibly there is some sort of confusion or uncertainty in what the complier actual sees here. Somehow I am going in and out of a literal string but at the same time joining them with a valid literal character of no length. Possibly somehow simultaneously two strings are seen but accompanying or applied to the same memory space, such as seeing the blue and purple in the following at the same point of zero length “ ““ “ . Having recognised a literal “ at “zero” length, it therefore joins the two sides of that text string with a single “ between at that point. This “ being added at point of zero length is like “inserting in” , which then somehow “shifts” appropriately, effectively adding 1 to the length ( Ref A.E. Jan 2016 )

Display text and quotes in cell from text in Range Object .Formula
Just taking the above one step further as this will also help in the understanding of the code routines discussed here. The Range Object can be given a formula, (with VBA as in Line 140) . (This typically is then seen displayed in the Formula bar). Writing manually in a cell = is recognised by Excel as indicating that what comes after is a formula. Text can be included in a formula, and the same convention is used as in VBA to indicate this by enclosing the text in a quote pair “ “. ( We would write manually like = "Some Text" ).
( _ .. At this point, in an attempt to help minimise the inevitable confusion that arises from the whole quotes theme, I use a general convention of
_ ..Blue font showing all VBA stuff which includes the quotes and ampersands used to build formula expressions
_ ..and
Green font showing what one actually would write in a spreadsheet cell and includes the literal quotes and ampersands needed to assign to the Range Object to get the final wanted result in the spreadsheet cell
_.. and Purple font showing what one needs to write ( in our discussions quote pairs ) differently within a VBA String in order to get something similar ( In our discussions a single quote ) in a String text written to a cell. For most normal simple characters and numbers ( in other words mostly non punctuation ) the color Purple translates directly to the color green , so will be shown in green to help the necessary different Purple more apparent.

In a spreadsheet one would manually write something of this form
="Some Text” or ="Some " & "Text" – Note here that I often include extra coupling through some redundant &s , as this helps constancy and compatibility / modifying and building strings.
In a string built in VBA to paste out to a cell we need to produce a string which internally looks like those_.
_. This would then take these forms in VBA code ( Lines 170 and 180 )
strText = "=" & """Some Text""" or strText = "=" & """Some “”" & "&" & """Text"""

Note: In a Range Object the formula String values, such as .Formula and the “value” String values are related. We may therefore assign out formula String, strText to either the Range Object .Formula or .Value. Regardless we will see displayed the Formula in the Formula bar, and the value, .Value, in the cell Some_Text_Formula_Value.JPG http://imgur.com/XVEzS7H

' '2b)(i)
It can be confusing to go finally to the case of a VBA string which will produce a final seen string value in a cell which may also include a quote. But really it is just a careful progression of the steps and ideas discussed thus far.
For example, say, we finally want this displayed in a cell
Some Text and a Quote "
But we want that to come from a formula ( as seen in the Formula bar )
Based on what we have disused thus far, we would need to write manually in the cell something of this form
=”Some Text and a Quote “ & “”””
One way to achieve this would be produce this String in VBA to be written to the Range Object of that cell
strText = "= " & """Some Text and a Quote """ & "&" & """"""""""
Once again for clarity here: That last line needs to produce the string in Debug.Print ( or as seen by hovering with the mouse over strText after the code has passed that line in debug, F8 mode ) which looks like we would manually write in the cell
Code lines in ' '2b)(i) take us through the above

Lines in ' '2b)(ii) follow a similar development to finally put a Formula into the Range Object of cell C3 to produce a simple test string displayed in the spreadsheet cell. HelloFromC3.JPG http://imgur.com/k9IYFUj
Note here: Lines 240 – 260 shows how it comes about that we typically see a code line such as code line 260 which I suggest gives the false idea of a Cells( ) Property which takes arguments. In fact I believe we are looking at the default Property of the Range Item Property applied to the first area Range Object of contiguous cells of the Range Object returned by the Cells Property. ( The Cells Property applied to a Worksheet can only return a single area of contiguous cells , but a Range Object is organised into a collection such areas of contiguous cells )



_.......
That covers the basics behind putting displayed text into a cell through using VBA to fill in the Formula of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value it displays. The reason for doing that will become apparent in the explanation of the second part of the code on the over next post is reviewed
_....

DocAElstein
10-28-2021, 11:56 AM
This is post #22071


Copy from http://www.excelforum.com/showthread.php?t=1154829&page=11#post4555023 https://www.excelforum.com/development-testing-forum/1154829-collection-stuff-of-codes-for-other-threads-no-reply-needed.html#post4555023



Function and demo Codes to Demonstrate Range Item Property
Introduction, what is this post about? :
This Post explains some preliminary ideas that covers the basics behind putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string ( .Formula ( .Formula is the column letter and row number convention formula type ) ) to the Range Object to which the displayed cell obtains the value ( .Value ) it displays. ( So it ends up looking like this in the Spreadsheet http://imgur.com/k9IYFUj . For that example we will learn that in VBA we need to do something like this "=" & """""""" & "Hello from C3" & """""""" to put those values in )
The code of which the first half is described in this post, ( and shown in the next post http://www.excelforum.com/showthread.php?t=1154829&page=12&p=4555024#post4555024 is a demo code routine ( not a Function ) to illustrate the basic ideas behind the Function in the over over next posts. But it makes a good parallel alternative explanation of the
Range Item Property
The Range Item Property is used to return a single cell Range Object starting from the top left cell of a Range Object of one or more contiguous ( all there ) cells (More correctly said a Range Object of one or more Range Objects from a contiguous spreadsheet rectangular area ). It applies specifically to one area. ( A Range Object can be that of only one rectangular area of contiguous spreadsheet rectangular, but strictly speaking the first area , which mostly we talk about, is just one of many possible. Strictly speaking a Range Object is a collection of one or more Range Objects from a contiguous spreadsheet rectangular areas. Typically we use just one and when we use a code part like Rng. VBA assumes we meant to write Rng.Areas.Item(1). )
Range Item Property and Demo code description
The Range Item Property follows for two argument case the usual spreadsheet ( row_coordinate , column_coordinate ) convention starting from top left and going ( for positive coordinates ) “down” the “rows” and “across to the right” of columns.
For the single argument case, ( integer item number or integer index ) , the Range Item Property follows the usual all columns “across to the right” , then next row “down” convention.
Rem 1) The first few code lines use the Cells Property to return a Range Object of all the cells ( Range Objects ) in a Worksheet.
( Lines 50 – 70 shows how it comes about that we typically see a code line such as code line 70. I would suggest that is one of the main uses of the Cells Property http://www.excelforum.com/showthread.php?t=1154829&page=11#post4552374 http://www.excelforum.com/showthread.php?t=1154829&page=11#post4553399 )
Quotes in Excel VBA
As an aside we need to tackle this tricky theme, as a quick review will help make the following explanations and code lines a little less daunting.
http://www.excelfox.com/forum/showthread.php/1891-Multiple-Columns-Into-Single-Column-Using-Data-Text-To-Column/page2#post8836
http://www.mrexcel.com/forum/excel-questions/696820-quotes-visual-basic-applications.html#post4283381
http://www.excelfox.com/forum/showthread.php/2042-Special-concatenation?p=9517#post9517
http://www.eileenslounge.com/viewtopic.php?f=27&t=25298&p=196259#p196259
Our final goal in this sub section is to be able to confidentially put a formula string in a cell using VBA. That is to say ...putting displayed text into a cell through using VBA to fill in one of the Formula Properties memories of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value ( .Value ) it displays...( and doing that such that literal quotes appear within the final “seen” cell displayed text )

Display text in cell from text in Range Object .Value
Generally in VBA a start and a stop quote “ “ signal that what between is a String. So a code line like_..
Range(“A1”).Value = “Some Text”
_.. or code lines like
Dim strText As String
__ strText = "Some Text"
__ Range("A1").Value = strText
_..will recognise __ Some Text __ as a literal string and give the Range Object of the first cell that value, __ Some Text __ The .Value Property will become this string value by virtue of the ( write ) lines 100 and 110. ( The .Value Property is the Range Object value that is displayed by default in the spreadsheet cell ). This can also be seen clearly by stepping past ( F8 Debug mode code progression ) the code line 115 and hitting Ctrl+G to reveal in the Immediate ( Debug ) window, what the code line Debug.Print has “printed out” to that Window. ( The Immediate ( Debug ) Window is a help window available to us ) . The code Ws.Range("A1").Value has effectively read what is held in the Range Object of cell A1 for its .Value
( In line 140, we “write” via .Formula our string formula in column letter and row number notation type to the Range Object Property which houses those type of strings. That sounds reasonable. But using .Value will also work. I expect there is a parallel or the same thing going on there to when you manually write in a cell = ... after this Excel is expecting a formula and assigns appropriately the various values Properties, and then finally displays in the cell the .Value, and in the formula bar the .Formula )

Adding quotes to strings
To have a quote displayed requires generally within the string a double quote. If there is a strict theory to that then I expect very few people are privy to that. Two possible explanations I can think off are
_ the complier or similar simply looks inside text after a single quote for pairs and makes the appropriate addition in the held string
_ a syntax of a pair of quotes is always required and as such allowed. Effectively as in typical HTML type code these “start and stop “Tags”” signal that what within is a literal text. As such a pair like “” is valid ( and signals an empty string ) , a double quote within like “””” or ” “” “ is also valid syntax . Possibly there is some sort of confusion or uncertainty in what the complier actual sees here. Somehow I am going in and out of a literal string but at the same time joining them with a valid literal character of no length. Possibly somehow simultaneously two strings are seen but accompanying or applied to the same memory space, such as seeing the blue and purple in the following at the same point of zero length “ ““ “ . Having recognised a literal “ at “zero” length, it therefore joins the two sides of that text string with a single “ between at that point. This “ being added at point of zero length is like “inserting in” , which then somehow “shifts” appropriately, effectively adding 1 to the length ( Ref A.E. Jan 2016 )

Display text and quotes in cell from text in Range Object .Formula
Just taking the above one step further as this will also help in the understanding of the code routines discussed here. The Range Object can be given a formula, (with VBA as in Line 140) . (This typically is then seen displayed in the Formula bar). Writing manually in a cell = is recognised by Excel as indicating that what comes after is a formula. Text can be included in a formula, and the same convention is used as in VBA to indicate this by enclosing the text in a quote pair “ “. ( We would write manually like = "Some Text" ).
( _ .. At this point, in an attempt to help minimise the inevitable confusion that arises from the whole quotes theme, I use a general convention of
_ ..Blue font showing all VBA stuff which includes the quotes and ampersands used to build formula expressions
_ ..and
Green font showing what one actually would write in a spreadsheet cell and includes the literal quotes and ampersands needed to assign to the Range Object to get the final wanted result in the spreadsheet cell
_.. and Purple font showing what one needs to write ( in our discussions quote pairs ) differently within a VBA String in order to get something similar ( In our discussions a single quote ) in a String text written to a cell. For most normal simple characters and numbers ( in other words mostly non punctuation ) the color Purple translates directly to the color green , so will be shown in green to help the necessary different Purple more apparent.

In a spreadsheet one would manually write something of this form
="Some Text” or ="Some " & "Text" – Note here that I often include extra coupling through some redundant &s , as this helps constancy and compatibility / modifying and building strings.
In a string built in VBA to paste out to a cell we need to produce a string which internally looks like those_.
_. This would then take these forms in VBA code ( Lines 170 and 180 )
strText = "=" & """Some Text""" or strText = "=" & """Some “”" & "&" & """Text"""

Note: In a Range Object the formula String values, such as .Formula and the “value” String values are related. We may therefore assign out formula String, strText to either the Range Object .Formula or .Value. Regardless we will see displayed the Formula in the Formula bar, and the value, .Value, in the cell Some_Text_Formula_Value.JPG http://imgur.com/XVEzS7H

' '2b)(i)
It can be confusing to go finally to the case of a VBA string which will produce a final seen string value in a cell which may also include a quote. But really it is just a careful progression of the steps and ideas discussed thus far.
For example, say, we finally want this displayed in a cell
Some Text and a Quote "
But we want that to come from a formula ( as seen in the Formula bar )
Based on what we have disused thus far, we would need to write manually in the cell something of this form
=”Some Text and a Quote “ & “”””
One way to achieve this would be produce this String in VBA to be written to the Range Object of that cell
strText = "= " & """Some Text and a Quote """ & "&" & """"""""""
Once again for clarity here: That last line needs to produce the string in Debug.Print ( or as seen by hovering with the mouse over strText after the code has passed that line in debug, F8 mode ) which looks like we would manually write in the cell
Code lines in ' '2b)(i) take us through the above

Lines in ' '2b)(ii) follow a similar development to finally put a Formula into the Range Object of cell C3 to produce a simple test string displayed in the spreadsheet cell. HelloFromC3.JPG http://imgur.com/k9IYFUj
Note here: Lines 240 – 260 shows how it comes about that we typically see a code line such as code line 260 which I suggest gives the false idea of a Cells( ) Property which takes arguments. In fact I believe we are looking at the default Property of the Range Item Property applied to the first area Range Object of contiguous cells of the Range Object returned by the Cells Property. ( The Cells Property applied to a Worksheet can only return a single area of contiguous cells , but a Range Object is organised into a collection such areas of contiguous cells )



_.......
That covers the basics behind putting displayed text into a cell through using VBA to fill in the Formula of the Range Object of that cell, that is to say passing a formula string to the Range Object to which the displayed cell obtains the value it displays. The reason for doing that will become apparent in the explanation of the second part of the code on the over next post is reviewed
_....

DocAElstein
07-17-2023, 01:41 PM
dgaJGDJGD









https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
07-17-2023, 01:41 PM
Number stored as text, alignment of numeric values in cells
Evaluate Range correction

The problem from the last post lends itself nicely to the Evaluate Range ideas. As often, this idea is based on a simple mathematical formula, which is itself one of a few ways in Excel and VBA we have a few ways to coerce a text to a number:
In Excel and VBA we have a few ways to coerce or "Methods to convert", http://www.eileenslounge.com/viewtopic.php?p=309140#p309140
One simple way is to multiply by 1.

As ever with these Evaluate Range solutions, we start with a single cell formula which works in Excel.
Take the screenshot example from the last post. In C11 this appears to work, =1*A11
_____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
Row\ColABC
103

1145=1*A11

12
Worksheet: Sheet1
https://i.postimg.cc/prJFZt2s/1xA11.jpg
https://i.postimg.cc/prJFZt2s/1xA11.jpg (https://postimages.org/) 5105
What that simple formula appears to do is to make the 4 in cell A11 be written in cell C11 a true number, and so we effectively get rid of that warning of the form , "Number stored as Text"

Now the Evaluate Range bit.
Evaluate Range ideas are often a neat alternative to looping in VBA
Staying with Excel initially. (**Note: This explanation may not suit so well for an Excel version with the Spill/Dynamic arrays stuff, (currently from about version 365).)
In Excel, like in a lot of computer stuff, what we look at, or get as output to see, is based on something
chucking out from left to right
,then returning to the left, ( sometimes referred to as "invisible" character like Carriage Return vbCr )
, and then going to a new line/row, ( sometimes referred to as "invisible" character like LineFeed vbLf )
, then starting again until we get a 2 dimensional picture we as humans understand. In some cases this means that similar calculations may be done by default over an extended range, but normally we don’t see that as in Excel we look at doing stuff in one of excel boxes/cells. Somehow Excel will be wired to show a single value in a cell in a typical formula such as our =1*A11
Whether by design or accident, right from the start of when Excel came about, we can get some interesting results if we replace a single cell reference by a multiple one.
For example, in C11, write =1*A11:B11 instead, so as to maybe see if we can somehow do our basic formula for cells A11 and B11 at the same time.
But, try that and it will error**. Never mind. Let’s keep experimenting.
https://i.postimg.cc/k5CmNLgp/1x-A11-B11.jpg
https://i.postimg.cc/zBXY6WWw/1xA11B11.jpg
(** For Excel 365 it may not error, and I prefer not to consider yet what is happening there)

Type 1 CSE entry
There may be some reason such as extra overheads for Excel to show the same calculation for both cells, resulting in perhaps a deliberate prevention of the thing working, but my guess is that it does work without too much effort. Often we talk about Type 1 CSE entry, or CSE entry in general, as a way to tell Excel that you would like to take advantage of the possibility to do the calculation for a range other than a single cell.
To get the first inclination about what I am talking about, do this: do the same thing again, in C11, write =1*A11:B11 , but don’t hit Enter yet. Instead, hold keys Ctrl+Shift and then hit Enter
We don’t error anymore. But we still only see one value. https://i.postimg.cc/m2v5xMCx/1x-A11-B11-CSE1.jpg
If you apply a bit of lateral thinning to what we said earlier about how computer things work , ( ……chucking out from left to right , returning to the left and gong to a new line/row, then starting again ) , a good guess might be that in our example the other calculated value might be somewhere close to the right. That takes us nicely on to the next section, and how that relates to our example

Type 2 CSE entry
CSE generally seems to tell Excel to do multiple cell calculations, at least that is what we suggested. (We talk sometimes about "array calculations", but this may be strictly in mathematical definitions a bit incorrect)
But we generally write things in a cell, and generally for simple formulas we would expect a result in a cell.

But let's try it a bit differently, bearing in mind our example. So, start again, but before you type =1*A11:B11, first select the two cells, C11 and D11. Then after you type that, do the CSE entry again, not a simple Enter
https://i.postimg.cc/m2w2rQN9/1x-A11-B11-CSE2.jpg
Bingo!
https://i.postimg.cc/m2RgRdMR/1x-A11-B11-CSE2-Bingo.jpg
https://i.postimg.cc/z3trFF0P/1x-A11-B11-CSE2-Bingo.jpg (https://postimg.cc/z3trFF0P) 5106


Evaluate Range Solution as alternative to VBA Looping
So far we have just considered an Excel solution. That background was necessary to understand the Evaluate Range type Solution as alternative to VBA Looping
In VBA, a conventional way to do multi cell calculations would be to Loop. It loops, in other words does a similar codung a few times. It would need to do it twice, https://i.postimg.cc/Wb8ZRJM7/Loop-in-values-in-row-12-column-C-and-D-from-column-A-and-B.jpg , in our example:
Sub LoopItTwice() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21924&viewfull=1#post21924
Dim Nmbr As Long
For Nmbr = 1 To 2 Step 1
Let ActiveSheet.Cells.Item(12, Nmbr + 2).Value = ActiveSheet.Cells.Item(11, Nmbr).Value ' Always uses row 12 , done twice, first for column 3 value = column 1 value and then column 4 value = column 2
Next Nmbr
End Sub

We have just discussed that the CSE stuff in Excel gives us a way to do it in one go. Let’s investigate if we can do something like that in VBA

Do Excel stuff in VBA
In VBA there is a Evaluate("__") function. In simple terms, to a first approximation, we can put Excel formulas inside the quotes, here
Evaluate("here")
, and the result is returned, similar to what would be returned in a cell with that formula in it.
Exactly what may be "returned" (chucked at us from Evaluate("__") ) , may be many things, depending on the exact formula, so it makes sense that the thing is wired to return a Variant type, so that can hold whatever actual type comes from the evaluation. So something like this sort of form would be done in VBA
Dim Var As Variant
_Let Var = Evaluate("=A11:B11*1")

If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg

Sub RangeEvaluate()
Dim Var As Variant
Let Var = Evaluate("=A11:B11*1")

Stop ' If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
'https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
'https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg
End Sub

https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg
https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg (https://postimages.org/)

Occasionally, the Evaluate(" ") does not "return" more than one result in formulas involving multi cell ranges, but this appears to be a separate issue to the need for CSE measures. Often we can do empirically derived tricks to overcome such problems.
But in many cases the Evaluate(" ") does returns the same results immediately that are only returned in a spreadsheet via the CSE way discussed. It would appear that principally the Evaluate(" ") is not restricted by the single cell , or need for CSE entry issues as in the spreadsheet. Perhaps this is because in use, Evaluate(" ") is not tied in some way to a particular spreadsheet format to show its output. There appears to be a lot of uncertainty ad empirically derived solutions and tricks in Evaluate Range

So, we have our result, or a way to get it chucked at us , "returned" , by using an Excel spreadsheet formula from within VBA
So what do we do with it/ how do we get it in a cell, or more specifically in our example, how do we get it in cells,
……. Next post

DocAElstein
07-17-2023, 01:41 PM
This is post #22059


Some notes arising from discussions in this Thread
http://www.eileenslounge.com/viewtopic.php?f=30&t=39898&sid=6084746d589f95e0bf61085a6575decc







Number stored as text, alignment of numeric values in cells
This problem/feature pops up from time to time.
https://i.postimg.cc/GpwT3Mzj/Number-stored-as-text.jpg
https://i.postimg.cc/18B3Jrkg/Number-stored-as-text.jpg (https://postimg.cc/18B3Jrkg) 5104

I have seen it so far in these sort of places/ things, such as text box contents are strings by definition (http://www.eileenslounge.com/viewtopic.php?p=309140#p309140) , …VBA enters text that is inherent to a TextBox. Every 'number' in a textBox is a string "1234". VBA has to convert those strings into long/integer, etc….

, and when pasting things out,
https://www.eileenslounge.com/viewtopic.php?p=269105#p269105 https://eileenslounge.com/viewtopic.php?p=272704#p272704
, but it’s not always consistent, - in the next example the 3 seems to go in as a number, but the 4 and 5 go in as …" Number stored as text"
https://i.postimg.cc/cCzwRfG1/Number-stored-as-text-inconsistancy.jpg

' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21923&viewfull=1#post21923
Sub Number_stored_as_text__alignment_of_numeric_values _in_cells() ' https://i.postimg.cc/cCzwRfG1/Number-stored-as-text-inconsistancy.jpg
Dim Ex As String
Let Ex = "3"
Let ActiveSheet.Range("A10").Value = Ex ' Puts in as number
Dim Exs(1 To 2) As String: Let Exs(1) = "4": Exs(2) = "5"
Let ActiveSheet.Range("A11:B11").Value = Exs()
End Sub
https://i.postimg.cc/cCzwRfG1/Number-stored-as-text-inconsistancy.jpg (https://postimages.org/)


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
07-17-2023, 01:41 PM
Number stored as text, alignment of numeric values in cells
Evaluate Range correction

The problem from the last post lends itself nicely to the Evaluate Range ideas. As often, this idea is based on a simple mathematical formula, which is itself one of a few ways in Excel and VBA we have a few ways to coerce a text to a number:
In Excel and VBA we have a few ways to coerce or "Methods to convert", http://www.eileenslounge.com/viewtopic.php?p=309140#p309140
One simple way is to multiply by 1.

As ever with these Evaluate Range solutions, we start with a single cell formula which works in Excel.
Take the screenshot example from the last post. In C11 this appears to work, =1*A11
_____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
Row\ColABC
103

1145=1*A11

12
Worksheet: Sheet1
https://i.postimg.cc/prJFZt2s/1xA11.jpg
https://i.postimg.cc/prJFZt2s/1xA11.jpg (https://postimages.org/) 5105
What that simple formula appears to do is to make the 4 in cell A11 be written in cell C11 a true number, and so we effectively get rid of that warning of the form , "Number stored as Text"

Now the Evaluate Range bit.
Evaluate Range ideas are often a neat alternative to looping in VBA
Staying with Excel initially. (**Note: This explanation may not suit so well for an Excel version with the Spill/Dynamic arrays stuff, (currently from about version 365).)
In Excel, like in a lot of computer stuff, what we look at, or get as output to see, is based on something
chucking out from left to right
,then returning to the left, ( sometimes referred to as "invisible" character like Carriage Return vbCr )
, and then going to a new line/row, ( sometimes referred to as "invisible" character like LineFeed vbLf )
, then starting again until we get a 2 dimensional picture we as humans understand. In some cases this means that similar calculations may be done by default over an extended range, but normally we don’t see that as in Excel we look at doing stuff in one of excel boxes/cells. Somehow Excel will be wired to show a single value in a cell in a typical formula such as our =1*A11
Whether by design or accident, right from the start of when Excel came about, we can get some interesting results if we replace a single cell reference by a multiple one.
For example, in C11, write =1*A11:B11 instead, so as to maybe see if we can somehow do our basic formula for cells A11 and B11 at the same time.
But, try that and it will error**. Never mind. Let’s keep experimenting.
https://i.postimg.cc/k5CmNLgp/1x-A11-B11.jpg
https://i.postimg.cc/zBXY6WWw/1xA11B11.jpg
(** For Excel 365 it may not error, and I prefer not to consider yet what is happening there)

Type 1 CSE entry
There may be some reason such as extra overheads for Excel to show the same calculation for both cells, resulting in perhaps a deliberate prevention of the thing working, but my guess is that it does work without too much effort. Often we talk about Type 1 CSE entry, or CSE entry in general, as a way to tell Excel that you would like to take advantage of the possibility to do the calculation for a range other than a single cell.
To get the first inclination about what I am talking about, do this: do the same thing again, in C11, write =1*A11:B11 , but don’t hit Enter yet. Instead, hold keys Ctrl+Shift and then hit Enter
We don’t error anymore. But we still only see one value. https://i.postimg.cc/m2v5xMCx/1x-A11-B11-CSE1.jpg
If you apply a bit of lateral thinning to what we said earlier about how computer things work , ( ……chucking out from left to right , returning to the left and gong to a new line/row, then starting again ) , a good guess might be that in our example the other calculated value might be somewhere close to the right. That takes us nicely on to the next section, and how that relates to our example

Type 2 CSE entry
CSE generally seems to tell Excel to do multiple cell calculations, at least that is what we suggested. (We talk sometimes about "array calculations", but this may be strictly in mathematical definitions a bit incorrect)
But we generally write things in a cell, and generally for simple formulas we would expect a result in a cell.

But let's try it a bit differently, bearing in mind our example. So, start again, but before you type =1*A11:B11, first select the two cells, C11 and D11. Then after you type that, do the CSE entry again, not a simple Enter
https://i.postimg.cc/m2w2rQN9/1x-A11-B11-CSE2.jpg
Bingo!
https://i.postimg.cc/m2RgRdMR/1x-A11-B11-CSE2-Bingo.jpg
https://i.postimg.cc/z3trFF0P/1x-A11-B11-CSE2-Bingo.jpg (https://postimg.cc/z3trFF0P) 5106


Evaluate Range Solution as alternative to VBA Looping
So far we have just considered an Excel solution. That background was necessary to understand the Evaluate Range type Solution as alternative to VBA Looping
In VBA, a conventional way to do multi cell calculations would be to Loop. It loops, in other words does a similar codung a few times. It would need to do it twice, https://i.postimg.cc/Wb8ZRJM7/Loop-in-values-in-row-12-column-C-and-D-from-column-A-and-B.jpg , in our example:
Sub LoopItTwice() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21924&viewfull=1#post21924
Dim Nmbr As Long
For Nmbr = 1 To 2 Step 1
Let ActiveSheet.Cells.Item(12, Nmbr + 2).Value = ActiveSheet.Cells.Item(11, Nmbr).Value ' Always uses row 12 , done twice, first for column 3 value = column 1 value and then column 4 value = column 2
Next Nmbr
End Sub

We have just discussed that the CSE stuff in Excel gives us a way to do it in one go. Let’s investigate if we can do something like that in VBA

Do Excel stuff in VBA
In VBA there is a Evaluate("__") function. In simple terms, to a first approximation, we can put Excel formulas inside the quotes, here
Evaluate("here")
, and the result is returned, similar to what would be returned in a cell with that formula in it.
Exactly what may be "returned" (chucked at us from Evaluate("__") ) , may be many things, depending on the exact formula, so it makes sense that the thing is wired to return a Variant type, so that can hold whatever actual type comes from the evaluation. So something like this sort of form would be done in VBA
Dim Var As Variant
_Let Var = Evaluate("=A11:B11*1")

If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg

Sub RangeEvaluate()
Dim Var As Variant
Let Var = Evaluate("=A11:B11*1")

Stop ' If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
'https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
'https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg
End Sub

https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg
https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg (https://postimages.org/)

Occasionally, the Evaluate(" ") does not "return" more than one result in formulas involving multi cell ranges, but this appears to be a separate issue to the need for CSE measures. Often we can do empirically derived tricks to overcome such problems.
But in many cases the Evaluate(" ") does returns the same results immediately that are only returned in a spreadsheet via the CSE way discussed. It would appear that principally the Evaluate(" ") is not restricted by the single cell , or need for CSE entry issues as in the spreadsheet. Perhaps this is because in use, Evaluate(" ") is not tied in some way to a particular spreadsheet format to show its output. There appears to be a lot of uncertainty ad empirically derived solutions and tricks in Evaluate Range

So, we have our result, or a way to get it chucked at us , "returned" , by using an Excel spreadsheet formula from within VBA
So what do we do with it/ how do we get it in a cell, or more specifically in our example, how do we get it in cells,
……. Next post

DocAElstein
07-20-2023, 05:27 PM
From last post, to recap a bit……
Do Excel stuff in VBA
In VBA there is a Evaluate("__") function. In simple terms, to a first approximation, we can put Excel formulas inside the quotes, here
Evaluate("here")
, and the result is returned, similar to what would be returned in a cell with that formula in it.
Exactly what may be "returned" (chucked at us from Evaluate("__") ) , may be many things, depending on the exact formula, so it makes sense that the thing is wired to return a Variant type, so that can hold whatever actual type comes from the evaluation. So something like this sort of form would be done in VBA
Dim Var As Variant
_Let Var = Evaluate("=A11:B11*1")

If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg

Sub RangeEvaluate()
Dim Var As Variant
Let Var = Evaluate("=A11:B11*1")

Stop ' If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
'https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
'https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg
End Sub

https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg
https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg (https://postimages.org/)

So, we have our result, or a way to get it chucked at us , "returned" , by using an Excel spreadsheet formula from within VBA
So what do we do with it/ how do we get it in a cell, or more specifically in our example, how do we get it in cells


Simple application of Evaluate("=A11:B11*1") type solutions
( Put what is chucked at us, ("returned") into cells )
Conveniently, Excel VBA allows a “field” or array of values, in other words a “square” or grid full of values to be applied directly to a rectangular range, pseudo code examples:

Simple application of Evaluate("=A11:B11*1") type solutions
Conveniently, Excel VBA allows a “field” or array of values, in other words a “square” or grid full of values to be applied directly to a rectangular range, pseudo code examples:

Range(“A1:B2”) values = { a b
_________________--__________c d }

Range(“A1:C1”) values = { x y z }

Range(“D1:E1”) values = { 4, 5 }

The right hand side of that last equation could be the array or field of values which was returned by our example, Evaluate("=A11:B11*1") . An actual working syntax to do in VBA what we did via CSE techniques previously would be
Range("C11:D11").Value = Evaluate("=A11:B11*1")

VBA coding “ works backwards “ , doing the right hand side first, so if we wanted to replace the original range with the values without the Number stored as text thing, then this would work

Range("A11:B11").Value = Evaluate("=A11:B11*1")

At this point we note that this basic coding layout can be written in a few different forms. In particular, we have great flexibility on the right hand side by virtue of the fact that the Evaluate takes a string argument. We are free to build up strings in VBA as we choose. They can be built up from hard coded text, as we currently have, or we can also include VBA things which would be converted at run time to what they evaluate to. For example, Range("A11:B11").Address returns $A$11:$B$11 , which for our purposes, in spreadsheet syntax, as used in a spreadsheet cell, has the same effect as A11:B11. So that last code line could be written

Range("A11:B11").Value = Evaluate("=" & Range("A11:B11").Address & "*1")


The last two code lines are effectively replacing a range which might have the Number stored as text thing showing to a range without that showing. In other words, it removes the Number stored as text thing.
We are free to replace the range Range("A11:B11") with any range we choose.
_ It could be some variable defined as a range like this
Dim Rng As Range
Set Rng = Range("A11:B11")
Let Rng.Value = Evaluate("=" & Rng.Address & "*1")
_ Similarly, we could make some selection in the spreadsheet, and then run the macro on this range using
Let Selection.Value = Evaluate("=" & Selection.Address & "*1")
This last macro is often the most convenient, but bear in mind that it will replace the original range, and things done by VBA can’t be undone. Best would be to test first by pasting a copy in a spare range. For example, if you have data up to column F, then this would put the test range to the side of it.
Selection.Offset(0, 6).Value = Evaluate("=" & Selection.Address & "*1")
(As often in VBA, the Offset works on the top left, shifting the whole range with it. In the inner workings of Excel VBA, things are often anchored or referenced to the top left)

In a few posts time we some simple variations of the Evaluate range way to remove the Number stored as text thing issue, specifically we are making the last few coding version less susceptible to problems / more workable on different data types
But first we will recap and discuss a useful typical format / versions of our final coding for test and developments






https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
07-20-2023, 05:27 PM
From last post, to recap a bit……
Do Excel stuff in VBA
In VBA there is a Evaluate("__") function. In simple terms, to a first approximation, we can put Excel formulas inside the quotes, here
Evaluate("here")
, and the result is returned, similar to what would be returned in a cell with that formula in it.
Exactly what may be "returned" (chucked at us from Evaluate("__") ) , may be many things, depending on the exact formula, so it makes sense that the thing is wired to return a Variant type, so that can hold whatever actual type comes from the evaluation. So something like this sort of form would be done in VBA
Dim Var As Variant
_Let Var = Evaluate("=A11:B11*1")

If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg

Sub RangeEvaluate()
Dim Var As Variant
Let Var = Evaluate("=A11:B11*1")

Stop ' If you put a Stop statement (or alternatively click in the left margin to get a brown circle which works the same), then run the following full macro, then while it is paused, (or before you start) , highlight Var , hold key Shift and then hit key F9, to put a watch on that variable, then you can see the results.
'https://i.postimg.cc/vmPf13Cx/Put-a-watch-on-Var.jpg
'https://i.postimg.cc/mDtM77GX/Put-a-watch-on-Var.jpg
End Sub

https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg
https://i.postimg.cc/9Mb931YQ/Put-a-watch-on-Var.jpg (https://postimages.org/)

So, we have our result, or a way to get it chucked at us , "returned" , by using an Excel spreadsheet formula from within VBA
So what do we do with it/ how do we get it in a cell, or more specifically in our example, how do we get it in cells


Simple application of Evaluate("=A11:B11*1") type solutions
( Put what is chucked at us, ("returned") into cells )
Conveniently, Excel VBA allows a “field” or array of values, in other words a “square” or grid full of values to be applied directly to a rectangular range, pseudo code examples:

Simple application of Evaluate("=A11:B11*1") type solutions
Conveniently, Excel VBA allows a “field” or array of values, in other words a “square” or grid full of values to be applied directly to a rectangular range, pseudo code examples:

Range(“A1:B2”) values = { a b
_________________--__________c d }

Range(“A1:C1”) values = { x y z }

Range(“D1:E1”) values = { 4, 5 }

The right hand side of that last equation could be the array or field of values which was returned by our example, Evaluate("=A11:B11*1") . An actual working syntax to do in VBA what we did via CSE techniques previously would be
Range("C11:D11").Value = Evaluate("=A11:B11*1")

VBA coding “ works backwards “ , doing the right hand side first, so if we wanted to replace the original range with the values without the Number stored as text thing, then this would work

Range("A11:B11").Value = Evaluate("=A11:B11*1")

At this point we note that this basic coding layout can be written in a few different forms. In particular, we have great flexibility on the right hand side by virtue of the fact that the Evaluate takes a string argument. We are free to build up strings in VBA as we choose. They can be built up from hard coded text, as we currently have, or we can also include VBA things which would be converted at run time to what they evaluate to. For example, Range("A11:B11").Address returns $A$11:$B$11 , which for our purposes, in spreadsheet syntax, as used in a spreadsheet cell, has the same effect as A11:B11. So that last code line could be written

Range("A11:B11").Value = Evaluate("=" & Range("A11:B11").Address & "*1")


The last two code lines are effectively replacing a range which might have the Number stored as text thing showing to a range without that showing. In other words, it removes the Number stored as text thing.
We are free to replace the range Range("A11:B11") with any range we choose.
_ It could be some variable defined as a range like this
Dim Rng As Range
Set Rng = Range("A11:B11")
Let Rng.Value = Evaluate("=" & Rng.Address & "*1")
_ Similarly, we could make some selection in the spreadsheet, and then run the macro on this range using
Let Selection.Value = Evaluate("=" & Selection.Address & "*1")
This last macro is often the most convenient, but bear in mind that it will replace the original range, and things done by VBA can’t be undone. Best would be to test first by pasting a copy in a spare range. For example, if you have data up to column F, then this would put the test range to the side of it.
Selection.Offset(0, 6).Value = Evaluate("=" & Selection.Address & "*1")
(As often in VBA, the Offset works on the top left, shifting the whole range with it. In the inner workings of Excel VBA, things are often anchored or referenced to the top left)

In a few posts time we some simple variations of the Evaluate range way to remove the Number stored as text thing issue, specifically we are making the last few coding version less susceptible to problems / more workable on different data types
But first we will recap and discuss a useful typical format / versions of our final coding for test and developments






https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
07-20-2023, 07:15 PM
Number stored as text, alignment of numeric values in cells
Improved/ Extended Evaluate Range solution. Recap General Purpose solution
In a few posts time we will discusses extending the last solution to overcome a couple of problems that may occur with certain types of range data, specifically, if there may be empty cells or cells with real text in it. In this and the following 2 posts we will recap and come up with a general purpose solution to then go on and modify.

General all purpose version of our final Evaluate Range solution Range variable, Rng
Let us both standardise and recap on a good general purpose version of our Evaluate Range solution, with emphasis on learning and test and developing

Range variable, Rng
It’s probably more often than not a good idea to use a variable for our main data range. In technical terms we might re say that, as a variable for our main Range object. Using a variable for things is often a good idea, and particular a good idea for a range object, since Excel and Excel is all about boxes and manipulating them, and in VBA in particular, we have a lot of useful built in things like Methods, Properties, and the such, that we can use on them/ with them, in particular the range object since that is in particular to do with the box, and boxes structure that Excel is all about.
So for some test range, such as A1:F1,
https://i.postimg.cc/nctNH0WJ/Range-A1-F7.jpg
5113 https://i.postimg.cc/nM032YZR/Range-A1-F7.jpg (https://postimg.cc/nM032YZR)
, then somewhere towards the start of any macro we might have something like this
Dim Rng As Range
_Set Rng = Worksheets.Item("Sheet1").Range("A1:F7")
You can often get away without the Worksheets.Item("Sheet1"). , if you know what you are doing and are sure that Excel will guess correctly which worksheet you are wanting to refer to, but often in a final coding, Excel may guess wrong, so more fully referencing a range is a good habit to get into.
We may as well, from the start of our coding get fully into such good habits, and use a variable for the worksheet also
Dim Ws1 As Worksheet
_Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Dim Rng As Range
_Set Rng = Ws1.Range("A1:F7")
This Rng is referring to the test data range……._

DocAElstein
07-20-2023, 07:15 PM
Number stored as text, alignment of numeric values in cells
Improved/ Extended Evaluate Range solution. Recap General Purpose solution
In a few posts time we will discusses extending the last solution to overcome a couple of problems that may occur with certain types of range data, specifically, if there may be empty cells or cells with real text in it. In this and the following 2 posts we will recap and come up with a general purpose solution to then go on and modify.

General all purpose version of our final Evaluate Range solution Range variable, Rng
Let us both standardise and recap on a good general purpose version of our Evaluate Range solution, with emphasis on learning and test and developing

Range variable, Rng
It’s probably more often than not a good idea to use a variable for our main data range. In technical terms we might re say that, as a variable for our main Range object. Using a variable for things is often a good idea, and particular a good idea for a range object, since Excel and Excel is all about boxes and manipulating them, and in VBA in particular, we have a lot of useful built in things like Methods, Properties, and the such, that we can use on them/ with them, in particular the range object since that is in particular to do with the box, and boxes structure that Excel is all about.
So for some test range, such as A1:F1,
https://i.postimg.cc/nctNH0WJ/Range-A1-F7.jpg
5113 https://i.postimg.cc/nM032YZR/Range-A1-F7.jpg (https://postimg.cc/nM032YZR)
, then somewhere towards the start of any macro we might have something like this
Dim Rng As Range
_Set Rng = Worksheets.Item("Sheet1").Range("A1:F7")
You can often get away without the Worksheets.Item("Sheet1"). , if you know what you are doing and are sure that Excel will guess correctly which worksheet you are wanting to refer to, but often in a final coding, Excel may guess wrong, so more fully referencing a range is a good habit to get into.
We may as well, from the start of our coding get fully into such good habits, and use a variable for the worksheet also
Dim Ws1 As Worksheet
_Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Dim Rng As Range
_Set Rng = Ws1.Range("A1:F7")
This Rng is referring to the test data range……._

DocAElstein
07-20-2023, 10:16 PM
General all purpose version of our final Evaluate Range solution Range variable, The left hand side, LHS, of a general purpose code line.
The left hand side, LHS, of a general purpose code line.
_....... This Rng is referring to the test data range.
We want to modify/ correct that, so up until now that was the thing on the LHS.
But, it is convenient in test and development not to replace the original range, but perhaps rather, if you have space, put the output from the coding calculations somewhere alongside. That way if something goes wrong, you don’t have to try and find the original data in order to try again. For example this would be the LHS to place the result alongside to the right. _Let Rng.Offset(0, Rng.Columns.Count).Value =

That is a good choice to use as we are sure to place to the right, since we offset the output a number of column equal to the number of columns that the range has. Personally, I might do this
_Let Rng.Offset(0, Rng.Columns.Count + 1).Value =
, since an extra empty column in between can have later advantages.



















https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
07-20-2023, 10:16 PM
General all purpose version of our final Evaluate Range solution Range variable, The left hand side, LHS, of a general purpose code line.
The left hand side, LHS, of a general purpose code line.
_....... This Rng is referring to the test data range.
We want to modify/ correct that, so up until now that was the thing on the LHS.
But, it is convenient in test and development not to replace the original range, but perhaps rather, if you have space, put the output from the coding calculations somewhere alongside. That way if something goes wrong, you don’t have to try and find the original data in order to try again. For example this would be the LHS to place the result alongside to the right. _Let Rng.Offset(0, Rng.Columns.Count).Value =

That is a good choice to use as we are sure to place to the right, since we offset the output a number of column equal to the number of columns that the range has. Personally, I might do this
_Let Rng.Offset(0, Rng.Columns.Count + 1).Value =
, since an extra empty column in between can have later advantages.



















https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
07-22-2023, 01:39 PM
General all purpose version of our final Evaluate Range solution Range variable, The right hand side, RHS, of a general purpose code line.
The right hand side, RHS, of a general purpose code line.
As far as the RHS of the equation goes, that is our Evaluate Range bit, and that will want to be referencing our test data, which is simply Rng, as far as VBA is concerned – that is the whole point about using a variable,
However we need to remember that we need Excel spreadsheet syntax inside the Evaluate("____") . For simple hardcoding that is =A1:F7 , just as we would write it in the cell. We could also use fixed cell referencing, =$A$1:$F$7 , as for our purposes it would work just the same. So they are OK for us.
For our general purpose standardised solution we want to make it dynamic, in other words we don’t want to hard code to a specific range, but would like to be able to get the Excel syntax from our VBA Rng variable, regardless of what the actual range might be at any time in our test and development
The VBA Range.Address Property (Excel) is useful here ( https://learn.microsoft.com/en-us/office/vba/api/excel.range.address )
The VBA Range.Address Property
The VBA Range.Address Property has a few arguments, here is the first 4
RowAbsolute:= default value is True, which gives the absolute $ type references $A$1:$F$7 , which are OK for us
ColumnAbsolute:= default value is True, which gives the absolute $ type references $A$1:$F$7 , which are OK for us
ReferenceStyle:= default gives us the default Excel spreadsheet column Letter and row Number referencing ( in other words A1, B$3 etc., rather than RC[-1] stuff ) which we want
External:= This could do with a bit of discussion:
If we set this to True, which is not the default we are arguably doing things a bit better since we are ensuring we refer to the correct worksheet, (and the correct workbook).
https://i.postimg.cc/TYCc8Fc4/Range-A1-F7-Address-External-True.jpg
https://i.postimg.cc/zGvFq7tX/Range-A1-F7-Address-External-True.jpg
https://i.postimg.cc/jS1Q2fm6/Range-Address-External-A1-F7-Address-External-True.jpg
https://i.postimg.cc/LXmjVN2z/Range-A1-F7-Address-External-True-Debug-Print-in-Immediate-Window.jpg
And/ but note a couple of things,
_Although the full syntax is allowed in the worksheet, ( https://i.postimg.cc/jS78Gv9p/Full-external-referrence-acccepted-in-Worksheet.jpg
https://i.postimg.cc/fTF221H7/Full-Worksheet-referrence-acccepted-in-Worksheet.jpg ) , it is not necessary in the worksheet, since the formula is in the worksheets, so the extra syntax is redundant
_Evaluate(" ") is not necessarily always linked to a worksheet, so the full reference could be a good idea.
However, relying on the defaults for the VBA Range.Address Property on the RHS helps us to simplify the RHS equation, so we will not do this, but instead note*** we can do this better, more fuller referencing in another way, Later***.

So the point of this post was to produce a general purpose Evaluate Range type solution to then go on and extend, and this last bit was considering the RHS
Hard coded had in it of this form for the data range, , A1:F7 , and we noted that this will do as well, $A$1:$F$7
We can get that by relying on the defaults in the The VBA Range.Address Property and so can , in VBA get something like that from Rng.
https://i.postimg.cc/5jdHjw5R/Range-A1-F7-Address-default-Properties.jpg
5114 https://i.postimg.cc/sGmfNGNY/Range-A1-F7-Address-default-Properties.jpg (https://postimg.cc/sGmfNGNY)

Sub DevelopmentTest() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21964&viewfull=1#post21964
Dim Ws1 As Worksheet
Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Dim Rng As Range
Set Rng = Ws1.Range("A1:F7")
Debug.Print Rng.Address ' gives im Immediate Window $A$1:$F$7 ( After running macro, hit keys Ctrl+g from VB Editor to get Immediate window( Direktbereich in German), in which this code line should have put the value of Rng.Address(External:=True) something like this sort of form '[Number stored as text, alignment of numeric values in cells.xls]Sheet1'!$A$1:$F$7
Debug.Print Rng.Address(External:=True) ' After running macro, hit keys Ctrl+g from VB Editor to get Immediate window( Direktbereich in German), in which this code line should have put the value of Rng.Address(External:=True) something like this sort of form '[Number stored as text, alignment of numeric values in cells.xls]Sheet1'!$A$1:$F$7
End Sub


We want this result , $A$1:$F$7, to be available inside Evaluate(" ")
Possibly one of the most useful things about Evaluate(" ") is that it takes a string of text, in other words, what goes in between the " ") is in the syntax of what you would put in a worksheet cell. In VBA we are free to use actual hardcoded text and/ or VBA things to build up that text within VBA, following the usual VBA syntax rules of having text and other things joined by a __&___ Actual hard coded text, as you want in the worksheet formula goes inside a " ") pair. VBA things in VBA syntax should not be inside a " ") pair, as then VBA will first “do them” , and as long as they return a text string, the _&__ or _&_s will finally result in one final string.
If we are only using a single VBA thing, and nothing else, then " ") no pair is required, since the use of a " ")/FONT] pair in VBA coding tells VBA that it is being given actual hardcoded text. When the VBA thing is done, it returns a string, or text, which any _&__s would join to other text. What I am trying to say here is that to get the text $A$1:$F$7 inside Evaluate(" "), then this would do
Evaluate(Rng.Address)

As far as what VBA “sees”, that is the same as if you were to write this
Evaluate("$A$1:$F$7")

A few oddities
It is not clear why you do not need a leading [FONT=Courier New]=, but it will accept it, and these return the same as if the = was ommited.
Evaluate("=" & Rng.Address)
Evaluate("=$A$1:$F$7")
My guess is that VBA assumes you have it/ effectively adds it by default if you miss it out. (Perhaps we should note here that we cannot write a simple text in Evaluate("__") as we would in a cell. This would error Evaluate("xyz")
Evaluate("__") will however take a number. This would not error Evaluate("6")
So there is not a perfect correlation between what we put in Evaluate("___" ) and what we put in a cell.
Perhaps Evaluate("__") is associated with all things in a cell to do with numbers and calculations. Simple text writing in a cell is something extra for a worksheet and slightly outside what Excel is about. Excel is mainly about boxes with numbers in it, and calculations on them


Almost finished, back to the main issue
Personally, even if I am just using a VBA thing in the Evaluate("__"), I prefer to include both leading and trailing " " bits, like this
Evaluate("=" & Rng.Address & "")
Doing that has the advantage, for example, of making it more easy to build up a final string.
In our case, for example, we finally want =1*A1:F7 ( or =1*$A$1:$F$7 will do just as well )
I think it is fairly easy at this stage to see what we finally need on the RHS:
__________________Evaluate("=1*" & Rng.Address & "")

One final Useful Tip
A final useful Tip, that helps to make sure you halve the correct syntax inside the Evaluate("___ ")
If we try to be very precise, I think we can say that it is the thing inside the brackets in this, Evaluate(___ ) , that takes the syntax of a string. Now, bearing that in mind, along with the fact that in VBA coding an enclosing " " needs to be used to tell VBA that you are giving it text, we can either hard code like this
_________________________ = Evaluate("=A1")
, or use a string variable like this
Dim strEval As String
_ Let strEval = "=A1"
_________________________ = Evaluate(strEval)
( We must always remember the strange exceptional difference between what we can put in a cell and what we can put in = Evaluate("___") – Unlike in a cell, it will not take a simple text , in Evaluate("___") it must be a formula or number. )

It is very easy to get text and text shown in enclosing "s mixed up, since often in various writings an enclosing " " pair may or may not be used. As an approximate general rule we can often say that
_ (i) a medium predominantly used for displaying normal human readable basic written text, will not display the text in enclosing "s.
_ (ii) a medium which uses text but may not predominantly be used to display normal human readable basic written text, or a medium not used to display some specific normal human readable basic written text that comes from somewhere else, (for example, when quoting some text from somewhere else) will enclose the normal human readable basic written text in enclosing "s.
VBA is like (ii) . It needs to be or otherwise coding might get mistaken for simple normal human readable basic written text


The Immediate Window, is like (i) , because its primary use is to allow us to see the single value in a simple variable, or one element of an array.
OK, now the Tip
What is inside the " " here, Evaluate(" ") or the actual text in our variable strEval is what we would manually put in an Excel cell.
So if we use
Debug.Print strEval
, then what is seen in the Immediate window should have the correct syntax for what we would manually write in an Excel cell. If it is not then, Evaluate(strEval) will most likely error.
Using our previous example,

Sub CheckSyntaxForEvalString()
Dim Ws1 As Worksheet, Rng As Range
Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Set Rng = Ws1.Range("A1:F7")
Dim strEval As String
Let strEval = "=1*" & Rng.Address & ""
Debug.Print strEval
End Sub
, we can clearly see that we have the correct syntax
https://i.postimg.cc/GpLGBTPQ/Debug-Print-str-Eval.jpg
5115 https://i.postimg.cc/G4fHV258/Debug-Print-str-Eval.jpg (https://postimg.cc/G4fHV258)
https://i.postimg.cc/GpLGBTPQ/Debug-Print-str-Eval.jpg (https://postimages.org/)

DocAElstein
07-22-2023, 01:39 PM
General all purpose version of our final Evaluate Range solution Range variable, The right hand side, RHS, of a general purpose code line.
The right hand side, RHS, of a general purpose code line.
As far as the RHS of the equation goes, that is our Evaluate Range bit, and that will want to be referencing our test data, which is simply Rng, as far as VBA is concerned – that is the whole point about using a variable,
However we need to remember that we need Excel spreadsheet syntax inside the Evaluate("____") . For simple hardcoding that is =A1:F7 , just as we would write it in the cell. We could also use fixed cell referencing, =$A$1:$F$7 , as for our purposes it would work just the same. So they are OK for us.
For our general purpose standardised solution we want to make it dynamic, in other words we don’t want to hard code to a specific range, but would like to be able to get the Excel syntax from our VBA Rng variable, regardless of what the actual range might be at any time in our test and development
The VBA Range.Address Property (Excel) is useful here ( https://learn.microsoft.com/en-us/office/vba/api/excel.range.address )
The VBA Range.Address Property
The VBA Range.Address Property has a few arguments, here is the first 4
RowAbsolute:= default value is True, which gives the absolute $ type references $A$1:$F$7 , which are OK for us
ColumnAbsolute:= default value is True, which gives the absolute $ type references $A$1:$F$7 , which are OK for us
ReferenceStyle:= default gives us the default Excel spreadsheet column Letter and row Number referencing ( in other words A1, B$3 etc., rather than RC[-1] stuff ) which we want
External:= This could do with a bit of discussion:
If we set this to True, which is not the default we are arguably doing things a bit better since we are ensuring we refer to the correct worksheet, (and the correct workbook).
https://i.postimg.cc/TYCc8Fc4/Range-A1-F7-Address-External-True.jpg
https://i.postimg.cc/zGvFq7tX/Range-A1-F7-Address-External-True.jpg
https://i.postimg.cc/jS1Q2fm6/Range-Address-External-A1-F7-Address-External-True.jpg
https://i.postimg.cc/LXmjVN2z/Range-A1-F7-Address-External-True-Debug-Print-in-Immediate-Window.jpg
And/ but note a couple of things,
_Although the full syntax is allowed in the worksheet, ( https://i.postimg.cc/jS78Gv9p/Full-external-referrence-acccepted-in-Worksheet.jpg
https://i.postimg.cc/fTF221H7/Full-Worksheet-referrence-acccepted-in-Worksheet.jpg ) , it is not necessary in the worksheet, since the formula is in the worksheets, so the extra syntax is redundant
_Evaluate(" ") is not necessarily always linked to a worksheet, so the full reference could be a good idea.
However, relying on the defaults for the VBA Range.Address Property on the RHS helps us to simplify the RHS equation, so we will not do this, but instead note*** we can do this better, more fuller referencing in another way, Later***.

So the point of this post was to produce a general purpose Evaluate Range type solution to then go on and extend, and this last bit was considering the RHS
Hard coded had in it of this form for the data range, , A1:F7 , and we noted that this will do as well, $A$1:$F$7
We can get that by relying on the defaults in the The VBA Range.Address Property and so can , in VBA get something like that from Rng.
https://i.postimg.cc/5jdHjw5R/Range-A1-F7-Address-default-Properties.jpg
5114 https://i.postimg.cc/sGmfNGNY/Range-A1-F7-Address-default-Properties.jpg (https://postimg.cc/sGmfNGNY)

Sub DevelopmentTest() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21964&viewfull=1#post21964
Dim Ws1 As Worksheet
Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Dim Rng As Range
Set Rng = Ws1.Range("A1:F7")
Debug.Print Rng.Address ' gives im Immediate Window $A$1:$F$7 ( After running macro, hit keys Ctrl+g from VB Editor to get Immediate window( Direktbereich in German), in which this code line should have put the value of Rng.Address(External:=True) something like this sort of form '[Number stored as text, alignment of numeric values in cells.xls]Sheet1'!$A$1:$F$7
Debug.Print Rng.Address(External:=True) ' After running macro, hit keys Ctrl+g from VB Editor to get Immediate window( Direktbereich in German), in which this code line should have put the value of Rng.Address(External:=True) something like this sort of form '[Number stored as text, alignment of numeric values in cells.xls]Sheet1'!$A$1:$F$7
End Sub


We want this result , $A$1:$F$7, to be available inside Evaluate(" ")
Possibly one of the most useful things about Evaluate(" ") is that it takes a string of text, in other words, what goes in between the " ") is in the syntax of what you would put in a worksheet cell. In VBA we are free to use actual hardcoded text and/ or VBA things to build up that text within VBA, following the usual VBA syntax rules of having text and other things joined by a __&___ Actual hard coded text, as you want in the worksheet formula goes inside a " ") pair. VBA things in VBA syntax should not be inside a " ") pair, as then VBA will first “do them” , and as long as they return a text string, the _&__ or _&_s will finally result in one final string.
If we are only using a single VBA thing, and nothing else, then " ") no pair is required, since the use of a " ")/FONT] pair in VBA coding tells VBA that it is being given actual hardcoded text. When the VBA thing is done, it returns a string, or text, which any _&__s would join to other text. What I am trying to say here is that to get the text $A$1:$F$7 inside Evaluate(" "), then this would do
Evaluate(Rng.Address)

As far as what VBA “sees”, that is the same as if you were to write this
Evaluate("$A$1:$F$7")

A few oddities
It is not clear why you do not need a leading [FONT=Courier New]=, but it will accept it, and these return the same as if the = was ommited.
Evaluate("=" & Rng.Address)
Evaluate("=$A$1:$F$7")
My guess is that VBA assumes you have it/ effectively adds it by default if you miss it out. (Perhaps we should note here that we cannot write a simple text in Evaluate("__") as we would in a cell. This would error Evaluate("xyz")
Evaluate("__") will however take a number. This would not error Evaluate("6")
So there is not a perfect correlation between what we put in Evaluate("___" ) and what we put in a cell.
Perhaps Evaluate("__") is associated with all things in a cell to do with numbers and calculations. Simple text writing in a cell is something extra for a worksheet and slightly outside what Excel is about. Excel is mainly about boxes with numbers in it, and calculations on them


Almost finished, back to the main issue
Personally, even if I am just using a VBA thing in the Evaluate("__"), I prefer to include both leading and trailing " " bits, like this
Evaluate("=" & Rng.Address & "")
Doing that has the advantage, for example, of making it more easy to build up a final string.
In our case, for example, we finally want =1*A1:F7 ( or =1*$A$1:$F$7 will do just as well )
I think it is fairly easy at this stage to see what we finally need on the RHS:
__________________Evaluate("=1*" & Rng.Address & "")

One final Useful Tip
A final useful Tip, that helps to make sure you halve the correct syntax inside the Evaluate("___ ")
If we try to be very precise, I think we can say that it is the thing inside the brackets in this, Evaluate(___ ) , that takes the syntax of a string. Now, bearing that in mind, along with the fact that in VBA coding an enclosing " " needs to be used to tell VBA that you are giving it text, we can either hard code like this
_________________________ = Evaluate("=A1")
, or use a string variable like this
Dim strEval As String
_ Let strEval = "=A1"
_________________________ = Evaluate(strEval)
( We must always remember the strange exceptional difference between what we can put in a cell and what we can put in = Evaluate("___") – Unlike in a cell, it will not take a simple text , in Evaluate("___") it must be a formula or number. )

It is very easy to get text and text shown in enclosing "s mixed up, since often in various writings an enclosing " " pair may or may not be used. As an approximate general rule we can often say that
_ (i) a medium predominantly used for displaying normal human readable basic written text, will not display the text in enclosing "s.
_ (ii) a medium which uses text but may not predominantly be used to display normal human readable basic written text, or a medium not used to display some specific normal human readable basic written text that comes from somewhere else, (for example, when quoting some text from somewhere else) will enclose the normal human readable basic written text in enclosing "s.
VBA is like (ii) . It needs to be or otherwise coding might get mistaken for simple normal human readable basic written text


The Immediate Window, is like (i) , because its primary use is to allow us to see the single value in a simple variable, or one element of an array.
OK, now the Tip
What is inside the " " here, Evaluate(" ") or the actual text in our variable strEval is what we would manually put in an Excel cell.
So if we use
Debug.Print strEval
, then what is seen in the Immediate window should have the correct syntax for what we would manually write in an Excel cell. If it is not then, Evaluate(strEval) will most likely error.
Using our previous example,

Sub CheckSyntaxForEvalString()
Dim Ws1 As Worksheet, Rng As Range
Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Set Rng = Ws1.Range("A1:F7")
Dim strEval As String
Let strEval = "=1*" & Rng.Address & ""
Debug.Print strEval
End Sub
, we can clearly see that we have the correct syntax
https://i.postimg.cc/GpLGBTPQ/Debug-Print-str-Eval.jpg
5115 https://i.postimg.cc/G4fHV258/Debug-Print-str-Eval.jpg (https://postimg.cc/G4fHV258)
https://i.postimg.cc/GpLGBTPQ/Debug-Print-str-Eval.jpg (https://postimages.org/)

DocAElstein
07-22-2023, 01:40 PM
Number stored as text, alignment of numeric values in cells
Improved/ Extended Evaluate Range solution.

Based on all the posts so far on this page, we have got this far,

Sub Number_stored_as_text() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21967&viewfull=1#post21967
Dim Ws1 As Worksheet, Rng As Range
Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Set Rng = Ws1.Range("A1:F7")
Dim strEval As String
Let strEval = "=1*" & Rng.Address & ""
Debug.Print strEval ' gives =1*$A$1:$F$7

Let Rng.Offset(0, Rng.Columns.Count + 1).Value = Evaluate(strEval)
End Sub
This is our test data, https://i.postimg.cc/KvhPVN44/Test-Data.jpg
https://i.postimg.cc/8PkRNCBV/Test-Data.jpg
5116https://i.postimg.cc/0rZKK7Yq/Test-Data.jpg (https://postimg.cc/0rZKK7Yq) https://i.postimg.cc/8PkRNCBV/Test-Data.jpg (https://postimages.org/)
_____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
Row\ColABCDEF
1PageLetterordernrQuantCostCost/quant

21122334455

31122334455

455443322110,5

555443322110,5

644Y234573460,71,7568741

755X223434160,74,60458453
Worksheet: Sheet1

This is the result after running the macro

_____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
Row\ColABCDEFGHIJKLM
1PageLetterordernrQuantCostCost/quant#WERT!#WERT!#WERT!#WERT!#WERT!#WERT!

2112233445511223344550

3112233445511223344550

455443322110,555443322110,5

555443322110,555443322110,5

644Y234573460,71,756874144#WERT!234573460,71,75687 4

755X223434160,74,6045845355#WERT!223434160,74,6045 85
Worksheet: Sheet1
https://i.postimg.cc/v8V73jYp/Test-Data-After.jpg (https://postimages.org/)


Oh bollox, a couple of problems
We see a couple of problems. An empty cell comes out as a 0 in the output, and text in any cell results in an error in the output.

In the next post, we look at overcoming these two problems

DocAElstein
07-22-2023, 01:40 PM
Number stored as text, alignment of numeric values in cells
Improved/ Extended Evaluate Range solution.

Based on all the posts so far on this page, we have got this far,

Sub Number_stored_as_text() ' https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21967&viewfull=1#post21967
Dim Ws1 As Worksheet, Rng As Range
Set Ws1 = ThisWorkbook.Worksheets.Item("Sheet1")
Set Rng = Ws1.Range("A1:F7")
Dim strEval As String
Let strEval = "=1*" & Rng.Address & ""
Debug.Print strEval ' gives =1*$A$1:$F$7

Let Rng.Offset(0, Rng.Columns.Count + 1).Value = Evaluate(strEval)
End Sub
This is our test data, https://i.postimg.cc/KvhPVN44/Test-Data.jpg
https://i.postimg.cc/8PkRNCBV/Test-Data.jpg
5116https://i.postimg.cc/0rZKK7Yq/Test-Data.jpg (https://postimg.cc/0rZKK7Yq) https://i.postimg.cc/8PkRNCBV/Test-Data.jpg (https://postimages.org/)
_____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
Row\ColABCDEF
1PageLetterordernrQuantCostCost/quant

21122334455

31122334455

455443322110,5

555443322110,5

644Y234573460,71,7568741

755X223434160,74,60458453
Worksheet: Sheet1

This is the result after running the macro

_____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2013 32 bit )
Row\ColABCDEFGHIJKLM
1PageLetterordernrQuantCostCost/quant#WERT!#WERT!#WERT!#WERT!#WERT!#WERT!

2112233445511223344550

3112233445511223344550

455443322110,555443322110,5

555443322110,555443322110,5

644Y234573460,71,756874144#WERT!234573460,71,75687 4

755X223434160,74,6045845355#WERT!223434160,74,6045 85
Worksheet: Sheet1
https://i.postimg.cc/v8V73jYp/Test-Data-After.jpg (https://postimages.org/)


Oh bollox, a couple of problems
We see a couple of problems. An empty cell comes out as a 0 in the output, and text in any cell results in an error in the output.

In the next post, we look at overcoming these two problems

DocAElstein
07-22-2023, 05:55 PM
Number stored as text, alignment of numeric values in cells
Improved/ Extended Evaluate Range solution.

Problem 1 text produces error in output.
Is it text or is it a number. Not as simple a question as you might think.
Initially a Layman might expect this problem, since multiplying a text by a number sounds dodgy. But we never know exactly how the makers of Excel program things, so we might just as well have thought it might return one of the text, or just recognise the text and so decide to do nothing but return it. But it appears that it errors.
So what to do.
The point of using these Evaluate Range ideas is to get a simple single code line that appears to do all in one go what more conventionally would be done in classic looping techniques. So initial we would usually see if we can solve the problem in the spreadsheet formula / expression.
We need something to help us distinguish between text and numbers, bearing in mind we have the complication of some numbers held as text. We want something that will distinguish between what we see as numbers and text, regardless of how Excel is holding anything we see as a number.
We have an ISTEXT and ISNUMBER function in Excel.
If we do some simple testing on the test data range we find that the ISTEXT will return true for our cells with a number stored as text, but not for cells with a simple number. So that looks perhaps less useful to us. Initially I did not expect the ISNUMBER to be useful either, since the Microsoft documentation say something like ISNUMBER("19") will return False.
Initial experiments confirm this. Take a small sample of our test range, A6:B7
https://i.postimg.cc/jdBJLVDM/Range-A6-B7.jpg
5117https://i.postimg.cc/8jBC00Bv/Range-A6-B7.jpg (https://postimages.org/)
https://i.postimg.cc/jdBJLVDM/Range-A6-B7.jpg (https://postimages.org/)

DocAElstein
07-22-2023, 05:55 PM
Number stored as text, alignment of numeric values in cells
Improved/ Extended Evaluate Range solution.

Problem 1 text produces error in output.
Is it text or is it a number. Not as simple a question as you might think.
Initially a Layman might expect this problem, since multiplying a text by a number sounds dodgy. But we never know exactly how the makers of Excel program things, so we might just as well have thought it might return one of the text, or just recognise the text and so decide to do nothing but return it. But it appears that it errors.
So what to do.
The point of using these Evaluate Range ideas is to get a simple single code line that appears to do all in one go what more conventionally would be done in classic looping techniques. So initial we would usually see if we can solve the problem in the spreadsheet formula / expression.
We need something to help us distinguish between text and numbers, bearing in mind we have the complication of some numbers held as text. We want something that will distinguish between what we see as numbers and text, regardless of how Excel is holding anything we see as a number.
We have an ISTEXT and ISNUMBER function in Excel.
If we do some simple testing on the test data range we find that the ISTEXT will return true for our cells with a number stored as text, but not for cells with a simple number. So that looks perhaps less useful to us. Initially I did not expect the ISNUMBER to be useful either, since the Microsoft documentation say something like ISNUMBER("19") will return False.
Initial experiments confirm this. Take a small sample of our test range, A6:B7
https://i.postimg.cc/jdBJLVDM/Range-A6-B7.jpg
5117https://i.postimg.cc/8jBC00Bv/Range-A6-B7.jpg (https://postimages.org/)
https://i.postimg.cc/jdBJLVDM/Range-A6-B7.jpg (https://postimages.org/)

DocAElstein
07-22-2023, 07:24 PM
later





https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
07-22-2023, 07:24 PM
later





https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 03:11 PM
LATER

DocAElstein
08-01-2023, 03:11 PM
later

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:17 PM
Some extra notes and experiments related this forum Page
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)/page58
https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell/page8
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21923&viewfull=1#post21923
https://www.excelfox.com/forum/showthread.php/2909-Appendix-Thread-Evaluate-Range-(-Codes-for-other-Threads-HTML-Tables-etc-)/page58#post21923



Some quirks with Excel Worksheet things ISTEXT and ISNUMBER https://support.microsoft.com/en-au/office/is-functions-0f2d7971-6019-40a0-a171-f2d869135665
Only by chance I noticed a while later that I was lucky that my solution worked here https://eileenslounge.com/viewtopic.php?p=309137#p309137
My answer in that Thread was an attempt to get rid of that Number stored as Text warning thing, https://i.postimg.cc/X7hZDNDg/Number-stored-as-text.jpg
https://i.postimg.cc/5NjY3Qp0/Number-stored-as-text.jpg https://i.postimg.cc/ppfXmvv9/Number-stored-as-text.jpg (https://postimg.cc/ppfXmvv9)https://i.postimg.cc/3d5xrRs5/Number-stored-as-text.jpg (https://postimg.cc/3d5xrRs5)

In the second worksheet in the uploaded file we have the main test data range from Chris, but to simplify this post I will just use a small section, A6:B7 , and do some simple Excel formulas initially involving ISTEXT and ISNUMBER
Initially results are as expected, or at least in a variation of one of the possibilities that we might have expected: The problem cell, A6, is seen as TEXT or not as a NUMBER
https://i.postimg.cc/6psVSh8q/ISTEXT-and-ISNUMBER-seems-OK-initially.jpg
5202https://i.postimg.cc/0bfJKDd1/ISTEXT-and-ISNUMBER-seems-OK-initially.jpg (https://postimg.cc/0bfJKDd1)
https://i.postimg.cc/6psVSh8q/ISTEXT-and-ISNUMBER-seems-OK-initially.jpg (https://postimages.org/)

The next set of results however show a slight anomaly. It would appear that in the larger formula pairs, the one of the pair which would effectively be doing just =A6 makes some change, bit only half way: The warning thing is gone, but the alignment has not changed ( The formula in the pair contain the *2 , I just did to check what of the two options after the IF was being selected. The results there confirm that the involving ISTEXT and ISNUMBER is behaving inside the n as it did on its own )
https://i.postimg.cc/7YJMmRYj/ISTEXT-and-ISNUMBER-behaviour-in-IF.jpg
5203 https://i.postimg.cc/zV5gf0hk/ISTEXT-and-ISNUMBER-behaviour-in-IF.jpg (https://postimg.cc/zV5gf0hk)
https://i.postimg.cc/7YJMmRYj/ISTEXT-and-ISNUMBER-behaviour-in-IF.jpg (https://postimages.org/)


In fact a simple cell reference exhibits a similar behaviour https://i.postimg.cc/3Nf7LBYx/A6.jpg

So a simple reference seems to be doing something strange, maybe getting sort of half way there.

Before going any further, we should perhaps try the same experiments in Evaluate(" ") , since things do not always work exactly the same in worksheet cells and in Evaluate(" ") : There are sometimes minor differences.

How does the function formulas behave in Evaluate(" ")
The spreadsheet looks similar, (the small difference is explained by VBA working in English, recognising the text I used as a Boolean at some point, possibly, perhaps at point of insertion, which my German Excel then displays in the appropriate German syntax word)
https://i.postimg.cc/26JkxYYK/Evaluate-to-Spreadsheet.jpg
https://i.postimg.cc/Q9QZXRHQ/Evaluate-to-Spreadsheet.jpg (https://postimg.cc/Q9QZXRHQ)
https://i.postimg.cc/26JkxYYK/Evaluate-to-Spreadsheet.jpg (https://postimages.org/)
_... continued in next post


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:17 PM
_... from last post


The Watch Window from coding is also not showing any surprises from Evaluate(" ") yet
I mean the Evaluate(" ") has not shown any great surprises yet.

Sub IstTextIstNumber() ' https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21970&viewfull=1#post21970
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Dim Rng As Range: Set Rng = Ws12.Range("A6:B7")
Dim vTemp As Variant
Let vTemp = Evaluate("=IF({1},ISTEXT(A6:B7))") ' https://i.postimg.cc/jWQ0QHvt/ISTEXT.jpg (https://postimg.cc/jWQ0QHvt)
Let Ws12.Range("A16:B17").Value = vTemp
Let Ws12.Range("A16:B17").Value = Evaluate("=IF({1},ISTEXT(A6:B7))")

Let vTemp = Evaluate("=IF(ISTEXT(A6:B7),""True"",""False"")") ' https://i.postimg.cc/FYS2NMfT/IF-ISTEXT.jpg (https://postimg.cc/FYS2NMfT)
Let Ws12.Range("A18:B19").Value = vTemp
Let Ws12.Range("A18:B19").Value = Evaluate("=IF(ISTEXT(A6:B7),""True"",""False"")")

Let vTemp = Evaluate("=IF({1},ISNUMBER(A6:B7))") ' https://i.postimg.cc/VN5tDYMq/ISNUMBER.jpg (https://postimages.org/)
Let Ws12.Range("A20:B21").Value = vTemp
Let Ws12.Range("A20:B21").Value = Evaluate("=IF({1},ISNUMBER(A6:B7))")

Let vTemp = Evaluate("=IF(ISNUMBER(A6:B7),""True"",""False"")") ' https://i.postimg.cc/SRpFgxXj/IF-ISNUMBER.jpg (https://postimages.org/)
Let Ws12.Range("A22:B23").Value = vTemp
Let Ws12.Range("A22:B23").Value = Evaluate("=IF(ISNUMBER(A6:B7),""True"",""False"")")


'_________________




End Sub


Now let’s move on to the more practical use
To recap:
We had the idea that we might be able to use the in-built Excel stuff ISTEXT or ISNUMBER to sort out our Number stored as text (https://i.postimg.cc/5NjY3Qp0/Number-stored-as-text.jpg) issue.
So far it looks unlikely………………, (but as a spoiler – maybe I don’t need to!)

Now, in a spare range, C12:D13, in the spreadsheet I did this CSE type 2 thing {=IF(ISNUMBER(A6:B7),1*A6:B7,A6:B7)}, and got this https://i.postimg.cc/PfWKPgtj/ISNUMBER-behaviour-in-IF.jpg
5204https://i.postimg.cc/yWN0GrgQ/ISNUMBER-behaviour-in-IF.jpg (https://postimg.cc/yWN0GrgQ) https://i.postimg.cc/PfWKPgtj/ISNUMBER-behaviour-in-IF.jpg (https://postimages.org/)
It appeared that we got the 1* done on the 55, but not on the 44, which was also thought a possibility, so making the ISNUMBERless useful to recognise that 44 as a number. But we noted it went half way, it’s doing half the job, sort of. We further noted that this rather means that the simple = A6 is doing half the job, sort of. This half the job, that is to say the half not yet finished, is something going on in the spreadsheet. Maybe that tells us what is going to happen next
So here we go:

Next post








.
.
.
.



.

.



https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:24 PM
Now let’s move on to the more practical use
To recap:
We had the idea that we might be able to use the in-built Excel stuff ISTEXT or ISNUMBER to sort out our Number stored as text (https://i.postimg.cc/5NjY3Qp0/Number-stored-as-text.jpg) issue.
So far it looks unlikely………………, (but as a spoiler – maybe I don’t need to!)

Now, in a spare range, C12:D13, in the spreadsheet I did this CSE type 2 thing {=IF(ISNUMBER(A6:B7),1*A6:B7,A6:B7)}, and got this https://i.postimg.cc/PfWKPgtj/ISNUMBER-behaviour-in-IF.jpg
5204https://i.postimg.cc/yWN0GrgQ/ISNUMBER-behaviour-in-IF.jpg (https://postimg.cc/yWN0GrgQ) https://i.postimg.cc/PfWKPgtj/ISNUMBER-behaviour-in-IF.jpg (https://postimages.org/)
It appeared that we got the 1* done on the 55, but not on the 44, which was also thought a possibility, so making the ISNUMBER less useful to recognise that 44 as a number. But we noted it went half way, it’s doing half the job, sort of. We further noted that this rather means that the simple = A6 is doing half the job, sort of. This half the job, that is to say the half not yet finished, is something going on in the spreadsheet. Maybe that tells us what is going to happen next
So here we go:
'_________________

'_________________
' THE MORE PRACTICAL USE..... IT APPEARED THAT WE GOT THE 1* DONE ON THE 55, BUT NOT ON THE 44, WHICH WAS ALSO THOUGHT A POSSIBILITY, SO MAKING THE ISNUMBERLESS USEFUL TO RECOGNISE THAT 44 AS A NUMBER. BUT WE NOTED IT WENT HALF WAY, IT’S DOING HALF THE JOB, SORT OF. WE FURTHER NOTED THAT THIS RATHER MEANS THAT THE SIMPLE = A6 IS DOING HALF THE JOB, SORT OF. THIS HALF THE JOB, THAT IS TO SAY THE HALF NOT YET FINISHED, IS SOMETHING GOING ON IN THE SPREADSHEET. MAYBE THAT TELLS US WHAT IS GOING TO HAPPEN NEXT
DIM STREVAL AS STRING
LET STREVAL = "=IF(ISNUMBER(A6:B7),1*A6:B7,A6:B7)"
LET VTEMP = EVALUATE("" & STREVAL & "") ' 5121https://i.postimg.cc/McK3CHRC/Ahh-its-working-somehow-unexpectidly-in-Evaluate-IF-ISNUMBER-then-put-that-in-cell.jpg (https://postimg.cc/McK3CHRC)
LET RANGE("C12:D13").VALUE = VTEMP
' AHH, ITS WORKING SOMEHOW UNEXPECTIDLY IN EVALUATE ( IF(ISNUMBER( ), ,) THEN PUT THAT IN CELL https://i.postimg.cc/tgh0VVg4/Ahh-its-working-somehow-unexpectidly-in-Evaluate-IF-ISNUMBER-then-put-that-in-cell.jpg (https://postimages.org/)

Strange , it works fully.
, and a quick check with strEval = "=IF(ISNUMBER(A6:B7),1*A6:B7,2*A6:B7)" confirms we are selecting the “ else ” part from the IF( , , else ) for the 44
https://i.postimg.cc/nC81B2FR/It-is-selcting-else-bit.jpg (https://postimg.cc/nC81B2FR)



So what is going on, next post is ….' Text strings in and out of spreadsheet and effect on Text held as number thing










Option Explicit
Sub IstTextIstNumber() ' https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21970&viewfull=1#post21970
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Dim Rng As Range: Set Rng = Ws12.Range("A6:B7")
Dim vTemp As Variant
Let vTemp = Evaluate("=IF({1},ISTEXT(A6:B7))") '
Let Ws12.Range("A16:B17").Value = vTemp
Let Ws12.Range("A16:B17").Value = Evaluate("=IF({1},ISTEXT(A6:B7))")

Let vTemp = Evaluate("=IF(ISTEXT(A6:B7),""True"",""False"")") '
Let Ws12.Range("A18:B19").Value = vTemp
Let Ws12.Range("A18:B19").Value = Evaluate("=IF(ISTEXT(A6:B7),""True"",""False"")")

Let vTemp = Evaluate("=IF({1},ISNUMBER(A6:B7))") '
Let Ws12.Range("A20:B21").Value = vTemp
Let Ws12.Range("A20:B21").Value = Evaluate("=IF({1},ISNUMBER(A6:B7))")

Let vTemp = Evaluate("=IF(ISNUMBER(A6:B7),""True"",""False"")") '
Let Ws12.Range("A22:B23").Value = vTemp
Let Ws12.Range("A22:B23").Value = Evaluate("=IF(ISNUMBER(A6:B7),""True"",""False"")")


'_________________
' The more practical use..... It appeared that we got the 1* done on the 55, but not on the 44, which was also thought a possibility, so making the ISNUMBERless useful to recognise that 44 as a number. But we noted it went half way, it’s doing half the job, sort of. We further noted that this rather means that the simple = A6 is doing half the job, sort of. This half the job, that is to say the half not yet finished, is something going on in the spreadsheet. Maybe that tells us what is going to happen next
Dim strEval As String
Let strEval = "=IF(ISNUMBER(A6:B7),1*A6:B7,A6:B7)"
Let vTemp = Evaluate("" & strEval & "") ' https://i.postimg.cc/qhS9F61w/Ahh-its-working-somehow-unexpectidly-in-Evaluate-IF-ISNUMBER-then-put-that-in-cell.jpg (https://postimg.cc/qhS9F61w)
Let Range("C12:D13").Value = vTemp
' Ahh, its working somehow unexpectidly in Evaluate ( IF(ISNUMBER( ), ,) then put that in cell
' https://i.postimg.cc/kGgqBx80/Ahh-its-working-somehow-unexpectidly-in-Evaluate-IF-ISNUMBER-then-put-that-in-cell.jpg (https://postimages.org/)
'
Let strEval = "=IF(ISNUMBER(A6:B7),1*A6:B7,2*A6:B7)"
Let vTemp = Evaluate("" & strEval & "") '
Let Range("C12:D13").Value = vTemp
' https://i.postimg.cc/nC81B2FR/It-is-selcting-else-bit.jpg (https://postimg.cc/nC81B2FR)
End Sub

DocAElstein
08-01-2023, 06:25 PM
.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:26 PM
Text strings in and out of spreadsheet and effect on Text held as number thing


The following macro in conjunction with the spreadsheet range, in this post in picture, (in the next post in more detail), experiments with putting the value of 44 in a spreadsheet in different ways, mostly as a string, and makes some attempt to see how the thing is then seen.
It is a bit too boring to explain every code line and everything in great detail. If and when you have the time then best go through the macro in the VB Editor in step F8 debug mode and follow through the various 'comments as you go along.
I will just give my conclusions at the end of the next post



' https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21975&viewfull=1#post21975
Sub Putting44HeldAsStringTypeInSpreadsheet_ThatStringI sInVariousVariablesAndArrays() ' https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21975&viewfull=1#post21975
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Ws12.Range("A30:C42").Clear
30 ' Simple string variable
Dim StrNmbr As String
Let StrNmbr = "44": Ws12.Range("B30").Value = VarTyp(VarType(StrNmbr))
Let Ws12.Range("A30").Value = StrNmbr: Let Ws12.Range("C30").Value = VarTyp(VarType(Ws12.Range("A30").Value))
31 ' Single Element of Single Element String type Element array
Dim StrNbr(1 To 1) As String
Let StrNbr(1) = "44": Ws12.Range("B31").Value = VarTyp(VarType(StrNbr(1)))
Let Ws12.Range("A31").Value = StrNbr(1): Let Ws12.Range("C31").Value = VarTyp(VarType(Ws12.Range("A31").Value))
32 ' Single Element String type Element array
Ws12.Range("B32").Value = VarTyp(VarType(StrNbr(1)))
Let Ws12.Range("A32").Value = StrNbr(): Let Ws12.Range("C32").Value = VarTyp(VarType(Ws12.Range("A32").Value))
33 ' Single Element of 2 Element String type Element array
Dim StrNbrs(1 To 2) As String
Let StrNbrs(1) = "44": Ws12.Range("B33").Value = VarTyp(VarType(StrNbrs(1)))
Let StrNbrs(2) = "45"
Let Ws12.Range("A33").Value = StrNbrs(1): Let Ws12.Range("C33").Value = VarTyp(VarType(Ws12.Range("A33").Value))
34 ' 2 Element String type Element array
Ws12.Range("B34").Value = VarTyp(VarType(StrNbrs()))
Let Ws12.Range("A34").Value = StrNbrs(): Let Ws12.Range("C34").Value = VarTyp(VarType(Ws12.Range("A34").Value))

35 ' Referrrence from a cell that is exhibiting the Number stored as text
Let Ws12.Range("A35").Value = "=A34": Ws12.Range("B35").Value = "** A35 is got from =A34": Ws12.Range("B35").Characters(Start:=21, Length:=5).Font.Name = "Courier New"
Let Ws12.Range("C35").Value = VarTyp(VarType(Ws12.Range("A35").Value))

36 ' A Variant variable holding a String
Dim vStrNmbr As Variant
Let vStrNmbr = "44": Ws12.Range("B36").Value = VarTyp(VarType(vStrNmbr))
Let Ws12.Range("A36").Value = vStrNmbr: Let Ws12.Range("C36").Value = VarTyp(VarType(Ws12.Range("A36").Value))
37 ' Single Element (String type) of a Single Element Variant type Element array
Dim vStrNbr(1 To 1) As Variant
Let vStrNbr(1) = "44": Ws12.Range("B37").Value = VarTyp(VarType(vStrNbr(1)))
Let Ws12.Range("A37").Value = vStrNbr(1): Let Ws12.Range("C37").Value = VarTyp(VarType(Ws12.Range("A37").Value))
Ws12.Range("B38").Value = VarTyp(VarType(vStrNbr()))
38 ' Single Element Variant type array (holding String type)
Let Ws12.Range("A38").Value = vStrNbr(): Let Ws12.Range("C38").Value = VarTyp(VarType(Ws12.Range("A38").Value))
39 ' Single Element(A String type) from a Variant 2 Element Array
Dim vStrNbrs(1 To 2) As Variant
Let vStrNbrs(1) = "44": Ws12.Range("B39").Value = VarTyp(VarType(vStrNbrs(1)))
Let vStrNbrs(2) = "45"
Let Ws12.Range("A39").Value = vStrNbrs(1): Let Ws12.Range("C39").Value = VarTyp(VarType(Ws12.Range("A39").Value))
Ws12.Range("B39").Value = VarTyp(VarType(vStrNbrs()))
40 ' Variant 2 Element Array (holding string types)
Let Ws12.Range("A40").Value = vStrNbrs(): Let Ws12.Range("C40").Value = VarTyp(VarType(Ws12.Range("A40").Value))


41 ' Referrence from a referrrence from a cell that is exhibiting the Number stored as text
Let Ws12.Range("A41").Value = "=A35": Ws12.Range("B41").Value = "** A41 is got from =A35": Ws12.Range("B41").Characters(Start:=21, Length:=5).Font.Name = "Courier New"
Let Ws12.Range("C41").Value = VarTyp(VarType(Ws12.Range("A41").Value))





' https://i.postimg.cc/8z8NGnQ9/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg
' 5123 https://i.postimg.cc/BXCdcpvB/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg (https://postimg.cc/BXCdcpvB)
' https://i.postimg.cc/8z8NGnQ9/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg (https://postimages.org/)

Let Ws12.Range("A42").Value = "=IF(1=1,A41)"
End Sub
Public Function VarTyp(ByVal Nr As Long) As String
Select Case Nr
Case 0
Let VarTyp = "Empty" ' (uninitialized)
Case 1
Let VarTyp = "Null" ' (no valid data)
Case 2
Let VarTyp = "Integer"
Case 3
Let VarTyp = "Long integer"
Case 4
Let VarTyp = "Single-precision floating-point number"
Case 5
Let VarTyp = "Double-precision floating-point number"
Case 6
Let VarTyp = "Currency value"
Case 7
Let VarTyp = "Date value"
Case 8
Let VarTyp = "String"
Case 9
Let VarTyp = "Object" 'If an object is passed and has a default property, VarType(object) returns the type of the object's default property.
Case 10
Let VarTyp = "Error value"
Case 11
Let VarTyp = "Boolean value"
Case 12
Let VarTyp = "Variant" ' (used only with arrays of variants)
Case 13
Let VarTyp = "A data access object"
Case 14
Let VarTyp = "Decimal value"
Case 17
Let VarTyp = "Byte value"
Case 20
Let VarTyp = "LongLong integer (valid on 64-bit platforms only)"
Case 36
Let VarTyp = "Variants that contain user-defined types"

'vbArray 8192 Array (always added to another constant when returned by this function)
'The VarType function never returns the value for vbArray by itself. It's always added to some other value to indicate an array of a particular type. For example, the value returned for an array of integers is calculated as vbInteger + vbArray, or 8194.
Case 8192 + 8
Let VarTyp = "Array of String type Elements"
Case 8192 + 12
Let VarTyp = "Array of Variant type Elements"
Case Else
Let VarTyp = "Bollox to " & Nr & " because I don't recognise that number"
End Select

End Function
' https://learn.microsoft.com/en-us/office/vba/language/reference/user-interface-help/vartype-function
'Either one of the following constants or the summation of a number of them is returned. ( These constants are specified by Visual Basic for Applications. The names can be used anywhere in your code in place of the actual values. )
'
'Constant Value Description
'vbEmpty 0 Empty (uninitialized)
'vbNull 1 Null (no valid data)
'vbInteger 2 Integer
'vbLong 3 Long integer
'vbSingle 4 Single-precision floating-point number
'vbDouble 5 Double-precision floating-point number
'vbCurrency 6 Currency value
'vbDate 7 Date value
'vbString 8 String
'vbObject 9 Object
'If an object is passed and has a default property, VarType(object) returns the type of the object's default property.
'vbError 10 Error value
'vbBoolean 11 Boolean value
'vbVariant 12 Variant (used only with arrays of variants)
'vbDataObject 13 A data access object
'vbDecimal 14 Decimal value
'vbByte 17 Byte value
'vbLongLong 20 LongLong integer (valid on 64-bit platforms only)
'vbUserDefinedType 36 Variants that contain user-defined types
'vbArray 8192 Array (always added to another constant when returned by this function)
'The VarType function never returns the value for vbArray by itself. It's always added to some other value to indicate an array of a particular type. For example, the value returned for an array of integers is calculated as vbInteger + vbArray, or 8194.
'

https://i.postimg.cc/8z8NGnQ9/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg
5205 https://i.postimg.cc/BXCdcpvB/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg (https://postimg.cc/BXCdcpvB)




https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:26 PM
Text strings in and out of spreadsheet and effect on Text held as number thing

In the following spreadsheet range, the range A30:C41 is filled in by the macro from the last post, ( also included in the file attached to this post )
What we are basically doing is storing the value of 44 in string format in various ways,
_ in simple variables and also
_ as elements in an array
, and then we look at putting
_ those variables,
_ or an element in an array,
_ or the whole array
, into a spreadsheet using the _ Range("G45").Value = __ type of way


https://i.postimg.cc/8z8NGnQ9/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg
5205 https://i.postimg.cc/BXCdcpvB/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg (https://postimg.cc/BXCdcpvB)
https://i.postimg.cc/8z8NGnQ9/Text-strings-in-and-out-of-spreadsheet-and-effect-on-Text-held-as-number-thing.jpg (https://postimages.org/)

_____ Workbook: Number stored as text, alignment of numeric values in cells.xls ( Using Excel 2010 32 bit )
Row\ColABCD
29Variable or array Element TypeType got from cell via .Value
after puting vaiable in cell with .Value
, ( ** or from cell referrence )

3044StringDouble-precision floating-point number Simple string variable

3144StringDouble-precision floating-point number Single Element of Single Element String type Element array

3244StringString Single Element String type Element array

3344StringDouble-precision floating-point number Single Element of 2 Element String type Element array

3444Array of String type ElementsString 2 Element String type Element array

3544** A35 is got from =A34String Referrrence from a cell that is exhibiting the Number stored as text thing

3644StringDouble-precision floating-point number A Variant variable holding a String

3744StringDouble-precision floating-point number Single Element (String type) of a Single Element Variant type Element array

3844Array of Variant type ElementsDouble-precision floating-point number Single Element Variant type array (holding String type)

3944Array of Variant type ElementsDouble-precision floating-point number Single Element(A String type) from a Variant 2 Element Array

4044Double-precision floating-point number Variant 2 Element Array (holding string types)

4144** A41 is got from =A35String Referrence from, a referrrence from a cell that is exhibiting the Number stored as text thing

4244Formula in A42 is =IF(1=1,A41)
Worksheet: Sheet1 (2)


Conclusions:
_1) If the thing we try to put in a cell via like Range("G45").Value = is a simple single value variable, there does not appear to be a way to put "44" in a cell which would result in getting that _ Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) _
_2) If the thing we try to put in a cell via like Range("G45").Value = is an element in an array, then the situation is slightly more varied. In order to get that Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) ,
_2)(i) the array type must be String. (It can even be an array of just one element as in the experiment example line 32)
, but _2)(ii) It must be applied as a an array – if you apply a single specific element from the array, then you will not get that Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)

So that is the case when we put in a cell or cells via like Range("G45").Value = , a variable or element of an array, or an array, and it seems that only an array of string type will work to get that Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) thing

In the next post we will look at consequences from these conclusions on Evaluate Range type solutions.








A few extra rough notes here
https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=11210&viewfull=1#post11210
https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)/page2#post11210


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:26 PM
hkjh


.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:26 PM
öjjj

.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:26 PM
khkjhh

.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:26 PM
öjlkjj


.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:27 PM
Evaluate Range type solutions,
Text strings in and out of spreadsheet and effect on Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Consequences to Evaluate Range type solutions, from conclusions from last post

These were the conclusions from the last few posts:
_1) If the thing we try to put in a cell via like Range("G45").Value = is a simple single value variable, there does not appear to be a way to put "44" in a cell which would result in getting that _ Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) _
_2) If the thing we try to put in a cell via like Range("G45").Value = is an element in an array, then the situation is slightly more varied. In order to get that Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) ,
_2)(i) the array type must be String. (It can even be an array of just one element as in the experiment example line 32)
, but _2)(ii) It must be applied as a an array – if you apply a single specific element from the array, then you will not get that Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)

So that is the case when we put in a cell or cells via like Range("G45").Value = , a variable or element of an array, or an array, and it seems that only an array of string type will work to get that Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) thing

We might be able to make a good guess on the conclusions, based on the following:
_ The evaluate range type solutions are of this general form
_____ Range(____) .Value = Evaluate(________)
_ The RHS of the equation replaces the array or array element or simple variable we were looking at in the last two posts.
_ Most usually our range evaluate solutions are involved in getting the RHS to return an array of values
_ In more general use, Evaluate(__) may return a large variety of different things, and so correspondingly it has been designed to return Variant. Theoretically in general we can have an array of string element types in a Variant, and we can show that this will give us a Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) , ( https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=11210&viewfull=1#post11210
https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)/page2#post11210 )
However we are playing around with spreadsheet ranges, and whether in a spreadsheet or in VBA, any thing, any wiring, that gets values from them is wired to have Variant type elements since values can be a few things like numbers empties, strings, etc. This last bit is a bit dodgy and I might have to think about that again.
But for now, let’s do some experiments and see what actually happens.

Test Range
What do we want to do?:- We want to see what happens when we work on ranges in Evaluate(" ") and then put the result back into the spreadsheet,
To get some cells exhibiting Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg), the Split function is convenient

Sub EvalAndHeldAsStringTypeInSpreadsheet()
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Let Ws12.Range("A50:D50").Value = Split("44 55 66 77")
https://i.postimg.cc/L4vDz4ZP/Split-Function-convenient-to-put-in-Number-held-as-string-thing.jpg
5206 https://i.postimg.cc/ThLnx602/Split-Function-convenient-to-put-in-Number-held-as-string-thing.jpg (https://postimg.cc/ThLnx602)
https://i.postimg.cc/L4vDz4ZP/Split-Function-convenient-to-put-in-Number-held-as-string-thing.jpg (https://postimages.org/)


https://i.postimg.cc/MKzQmgQj/Split-Function-convenient-to-put-in-Number-held-as-string-thing.jpg (https://postimages.org/)




In the next 3 post we will take a look at that range, when we work on those ranges in Evaluate(" ") and then put the result back into the spreadsheet




.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:27 PM
Results 1 Single Cell in/ out of Evaluate(" ")
This following macro is quite extensive, looking at what a variable assigned to the Evaluate(" ") looks like
variable = Evaluate(" ")
, then puts it in the spreadsheet via the typical
Range( "GH45").Value = variable
, and
Range( "GH45").Value = Evaluate(" ")

, a few surprises,

I will just try to summarise for now


Sub EvalAndHeldAsStringTypeInSpreadsheet_SingleCell() ' https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21978&viewfull=1#post21978
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Let Ws12.Range("A50:D50").Value = Split("44 55 66 77")
Dim vTemp As Variant, Rng As Range, Str As String, Lng As Long
Dim Strs1(1 To 1) As String, Strs() As String, Vs1(1 To 1) As Variant, Vs() As Variant

51 Let vTemp = Evaluate("=A50") ' Watch : : vTemp : "44" : Variant/String : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
' https://i.postimg.cc/WD7zd19J/Evaluate-range-on-Single-Cell.jpg (https://postimg.cc/WD7zd19J)
' https://i.postimg.cc/pdwF19zk/Evaluate-range-on-Single-Cell.jpg (https://postimages.org/)
Let Range("A51").Value = vTemp: Range("B51").Value = Evaluate("=A50")
52 Set Rng = Evaluate("=A50") ' Watch : + : Rng : "44" : Range/Range : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
Let Range("A52").Value = Rng: Range("B52").Value = Rng.Value: Range("C52").Value = Rng.Value2: Range("D52").Value = Rng.Text
53 Let Str = Evaluate("=A50") ' Watch : : Str : "44" : String : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
Let Range("A53").Value = Str
Let Range("B53").Value = Array(Str) ' Watch : - : Array(Str) : : Variant/Variant(0 to 0) : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet_Sin
' : Array(Str)(0) : "44" : Variant/String : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet_Sin
Dim arrStr() As String: ' Let arrStr = Array(Str) ' Error type mismatch
54 Let Lng = Evaluate("=A50") ' Watch : : Lng : 44 : Long : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
Let Range("A54").Value = Lng
Let Strs1(1) = Evaluate("=A50") ' Watch : : Strs1(1) : "44" : String : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet_Sin
Let Range("B54").Value = Strs1(1)
Let Range("C54").Value = Strs1() ' This does get the Number as text thing https://i.postimg.cc/QFS6DzYp/C54.jpg (https://postimg.cc/QFS6DzYp) https://i.postimg.cc/zyqd9N7z/C54.jpg (https://postimg.cc/zyqd9N7z)
' Let Strs() = Evaluate("=A50") ' Error Type mismatch
55 Let Vs1(1) = Evaluate("=A50") ' Watch : : Vs1(1) : "44" : Variant/String : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
Let Range("A55").Value = Vs1(1)
' Let Vs() = Evaluate("=A50") ' Error Type mismatch

56 Let vTemp = Array(Evaluate("=A50")) ' Watch : - : vTemp : : Variant/Variant(0 to 0) : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
' https://i.postimg.cc/x87T82MF/Array-Evaluate-A50.jpg + : vTemp(0) : : Variant/Object/Range : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
Let Range("A56").Value = vTemp: Range("B56").Value = Array(Evaluate("=A50")): ' Range("C56").Value = vTemp.Value: Range("D56").Value = Array(Evaluate("=A50")).Value ' Runtime Error 424 Object needed
57 Let vTemp = Array(Lng) ' Watch : + : vTemp : : Variant/Variant(0 to 0) : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
' https://i.postimg.cc/Wzt1s3Fk/Array-Lng.jpg : vTemp(0) : 44 : Variant/Long : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
Let Range("A57").Value = vTemp: Range("B57").Value = Array(Lng)
58 Let vTemp = Split(Lng) ' Watch : - : vTemp : : Variant/String(0 to 0) : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
' https://i.postimg.cc/FRTKtcRv/Split-Lng.jpg Watch : : Lng : 44 : Long : Sheet2.EvalAndHeldAsStringTypeInSpreadsheet
Let Range("A58").Value = vTemp: Range("B58").Value = Split(Lng)
' https://i.postimg.cc/5HVKnjhk/Results1-Single-Cell-in-out-of-Evaluate.jpg (https://postimg.cc/5HVKnjhk)
' https://i.postimg.cc/jjwVq7ZK/Results1-Single-Cell-in-out-of-Evaluate.jpg (https://postimages.org/)bild upload kostenlos (https://postimages.org/de/)


End Sub


5207 https://i.postimg.cc/5HVKnjhk/Results1-Single-Cell-in-out-of-Evaluate.jpg (https://postimg.cc/5HVKnjhk)
https://i.postimg.cc/jjwVq7ZK/Results1-Single-Cell-in-out-of-Evaluate.jpg (https://postimages.org/)


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:27 PM
5207 https://i.postimg.cc/5HVKnjhk/Results1-Single-Cell-in-out-of-Evaluate.jpg (https://postimg.cc/5HVKnjhk)
https://i.postimg.cc/jjwVq7ZK/Results1-Single-Cell-in-out-of-Evaluate.jpg (https://postimages.org/)







Results 1 Single Cell in/ out of Evaluate(" ")
Evaluate(" ") works a bit differently for a range.
It appears initially to return a range object. Put that in a cell via like
Range( "GH45").Value = That range object
, in the development coding example, B51 or A52, (and A56 or B56), or like in the macro below, and you will get that Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) preserved when that range object is “put in the cell” via like
Range( "GH45").Value = That range object

Sub SetRangeValueWithRange()
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Let Ws12.Range("A50:D50").Value = Split("44 55 66 77")
Dim CelRng As Range
Set CelRng = Ws12.Range("A50")
Let Ws12.Range("A60").Value = CelRng ' Gives Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Let Ws12.Range("B60").Value = CelRng.Value ' does not give "
' https://i.postimg.cc/MTw4jdpV/Set-Range-Value-to-one-with-Number-as-text-thing.jpg
' https://i.postimg.cc/rm9HGxDb/Set-Range-Value-to-one-with-Number-as-text-thing.jpg
' https://i.postimg.cc/MTw4jdpV/Set-Range-Value-to-one-with-Number-as-text-thing.jpg (https://postimages.org/) https://i.postimg.cc/rm9HGxDb/Set-Range-Value-to-one-with-Number-as-text-thing.jpg (https://postimages.org/)


End Sub
Otherwise you are not going to get the preservation directly via Evaluate(" ") . You would need to do some extra work to get the Value in a string element type array (of one element)

Saying something similar: Evaluate(" ") on a single cell range, like Evaluate("=G5") returns a range object of one cell. Depending on what type of variable you try to assign it to, it will coerce to all but an array. ( It will allow you to assign it to an element of an array, that array must be a variant or Range type. Applying to a Variant … lets look again at the measurements, Results, conclusions with hindsight in the next post…







.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:27 PM
Results/ Conclusions 1 Single Cell in/ out of Evaluate(" ")
Again some Measurements, Results and conclusions with hindsight

Consider the following coding.
Rem 0
Two cells are considered, both are similar numbers, only one of the cells exhibits the Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Rem 1
For a simple single cell range, Evaluate(" ") , seems to return an actual range object, and if we attempt to put that in a cell, it won’t default to taking the default property, .Value, instead it appears to put the range object in. This will preserve the string of a number held as a string, A70 and B70
If it did default to the .Value property, then we would get the result as in C70
Rem 2
If you assign the result from Evaluate(" ") for a simple single cell range, into a variable, then VBA seems to be quite obliging, coercing appropriately to suit the declaration of any reasonable variable type.
If the variable is a Variant, the type held in the Variant will be a string in the case of Evaluate(" ") of a cell exhibiting the number held as text thing.
Rem 3
Any attempt to put a string into a cell won’t give the number held as text thing. Strange.



Sub SetRangeValueWithSingleCellRangeFromEvaluate() ' https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21979&viewfull=1#post21979
Rem 0
' Test data range
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Ws12.Range("A69:D71").Clear ' .Clear to get rid of all valiues and any formats
Let Ws12.Range("A69").Value = Split("44") ' ' Gives Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Let Ws12.Range("D69").Value = "55" ' does not give "
' https://i.postimg.cc/GHFdY4r3/Two-cells-similar-numbers-applied-one-as-text.jpg (https://postimg.cc/GHFdY4r3)
' https://i.postimg.cc/HsKxqMhM/Two-cells-similar-numbers-applied-one-as-text.jpg (https://postimages.org/)
Rem 1
' Evalute(" ") from the single cell ranges
Dim VA69 As Variant, VD69 As Variant, RA69 As Range, RD69 As Range
' 1a) Fubdamentally, I think Evalute(" ") returns a range, and it knows what is what
Set RA69 = Evaluate("=A69") ' Watch : + : RA69 : "44" : Range/Range : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Set RD69 = Evaluate("=D69") ' Watch : + : RD69 : 55 : Range/Range : Sheet2.SetRangeValueWithSingleCellRangeFromEval

70 Let Ws12.Range("A70") = Evaluate("=A69") ' This appears to apply the range to a cell ..... and it knows waht is what

Let Ws12.Range("A70") = RA69 ' Watch : + : Ws12.Range("A70") : "44" : Object/Range : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let Ws12.Range("B70").Value = RA69 ' Watch : : Ws12.Range("B70").Value : "44" : Variant/String : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let Ws12.Range("C70") = RA69.Value ' Watch : + : Ws12.Range("C70") : 44 : Object/Range : Sheet2.SetRangeValueWithSingleCellRangeFromEval
' Watch : : RA69.Value : "44" : Variant/String : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let Ws12.Range("D70") = Evaluate("=D69")
Let Ws12.Range("D70") = RD69

Rem 2 Assigning Evalute(" ") to a variable is fairly obliging
Let VA69 = Evaluate("=A69") ' Watch : : VA69 : "44" : Variant/String : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let VD69 = Evaluate("=D69") ' Watch : : VB69 : 55 : Variant/Double : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Dim Str As String, Lng As Long
Let Str = Evaluate("=D69") ' Watch : : Str : "55" : String : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let Str = Evaluate("=A69") ' Watch : : Str : "44" : String : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let Lng = Evaluate("=A69") ' Watch : : Lng : 44 : Long : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let Lng = Evaluate("=D69") ' Watch : : Lng : 44 : Long : Sheet2.SetRangeValueWithSingleCellRangeFromEval

71 Rem 3 Any attempt to put a string into a cell won't give the number held as text thing
Let Ws12.Range("A71").Value = Str
Let Ws12.Range("B71") = Str
Let Ws12.Range("C71") = "45"

72 Rem 4
Dim arrRng(1 To 1) As Range
Set arrRng(1) = Evaluate("=A69") 'Watch : + : arrRng(1) : "44" : Range/Range : Sheet2.SetRangeValueWithSingleCellRangeFromEval
Let Ws12.Range("A72").Value = arrRng(1) ' gives the number held as text thing
Let Ws12.Range("A72").Value = arrRng() ' gives the number held as text thing
Let Ws12.Range("B72") = arrRng(1) ' gives the number held as text thing
Dim arrStr(1 To 1) As String
Let arrStr(1) = "46"
Let Ws12.Range("C72").Value = arrStr(1) ' this DOES NOT gives the number held as text thing
Let Ws12.Range("C72").Value = arrStr() ' gives the number held as text thing



' https://i.postimg.cc/mthCXNPg/Results-1-Single-Cell-experiments.jpg (https://postimg.cc/mthCXNPg)
' https://i.postimg.cc/c4BhJFZw/Results-1-Single-Cell-experiments.jpg (https://postimages.org/)
End Sub

DocAElstein
08-01-2023, 06:27 PM
lkjhj



.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:27 PM
SJHSASAHG

DocAElstein
08-01-2023, 06:28 PM
bjj



.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:28 PM
jkjhg


.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:28 PM
lkkhjlkhkh



.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:28 PM
öjlkhlh


.
.
.
.
.
..
.
.
.
.
.
.
..

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgyOh-eR43LvlIJLG5p4AaABAg.9isnKJoRfbL9itPC-4uckb)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugy1B1aQnHq2WbbucmR4AaABAg.9isY3Ezhx4j9itQLuif2 6T)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgxxajSt03TX1wxh3IJ4AaABAg.9irSL7x4Moh9itTRqL7d Qh)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=Ugxa2VYHMWJWXA6QI294AaABAg.9irLgSdeU3r9itU7zdnW Hw)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwJAAPbp8dhkW2X1Uh4AaABAg.9iraombnLDb9itV80HDp Xc)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgzIzQ6MQ5kTpuLbIuB4AaABAg.9is0FSoF2Wi9itWKEvGS Sq)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 06:28 PM
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/Written-Property-Value.jpg
5499 https://i.postimg.cc/14trwGsM/Written-Property-Value.jpg (https://postimg.cc/14trwGsM)
, or
, _ perhaps something from here.
https://i.postimg.cc/k5N8264j/Written-Property-values-from-Value.jpg
https://i.postimg.cc/McTX4G1R/Written-Property-values-from-Value.jpg (https://postimg.cc/McTX4G1R)

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 (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg), 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 (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) 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 (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) into another cell will not result in that other cell exhibiting the Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg): 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/Written-Property-Value.jpg
5499 https://i.postimg.cc/14trwGsM/Written-Property-Value.jpg (https://postimg.cc/14trwGsM)
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 (https://i.postimg.cc/g0LMNxFq/Number-stored-as-Text-Thing.jpg), we see there " 44 "
https://i.postimg.cc/Xq1HsdJL/Cell-A69.jpg
5500 https://i.postimg.cc/T5mJwyn5/Cell-A69.jpg (https://postimg.cc/T5mJwyn5)
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 (https://i.postimg.cc/g0LMNxFq/Number-stored-as-Text-Thing.jpg) warning thing preserved.


Some coding in the next posts demonstrate some of the above

DocAElstein
08-01-2023, 10:57 PM
Sub RangeObjectDefaultPropertiesCell() ' https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell?p=22092&viewfull=1#post22092 https://www.excelfox.com/forum/showthread.php/2345-Appendix-Thread-(-Codes-for-other-Threads-HTML-Tables-etc-)?p=21979&viewfull=1#post21979
Rem 0 ' Test data range
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Ws12.Range("A75:E75").Clear ' .Clear to get rid of all valiues and any formats
' LHS In the classic, (pseudo) code line Range2.Value = Range1.Value I don't experience any difference with the LHS being Range2.Value = or Range2 = Watch : : Ws12.Range("A69").Value : "44" : Variant/String : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("A69").Value = Split("44") ' ' Gives number stored as Text Thing https://i.postimg.cc/XYrvmWdH/Number-stored-as-Text-Thing.jpg Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Let Ws12.Range("A69").Value = Split("44") ' Watch : - : Split("44") : : Variant/String(0 to 0) : Sheet2.RangeObjectDefaultPropertiesCell
' : Split("44")(0) : "44" : String : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("A69").Value = Split("44") ' Watch : : Ws12.Range("A69").Value : "44" : Variant/String : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("A69") = Split("44") ' Watch : - : Ws12.Range("A69") : "44" : Object/Range : Sheet2.RangeObjectDefaultPropertiesCell

Let Ws12.Range("D69") = Split("44")(0) ' This does not give the Number stored as Text Thing https://i.postimg.cc/XYrvmWdH/Number-stored-as-Text-Thing.jpg Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg) Watch : : Ws12.Range("D69").Value : 55 : Variant/Double : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("D69") = Split("44")(0) ' Watch : : Split("44")(0) : "44" : Variant/String : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("D69") = Split("44")(0) ' Watch : + : Ws12.Range("D69") : 44 : Object/Range : Sheet2.RangeObjectDefaultPropertiesCell


Let Ws12.Range("D69").Value = 55 ' This does not give the Number stored as Text Thing https://i.postimg.cc/XYrvmWdH/Number-stored-as-Text-Thing.jpg Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Let Ws12.Range("D69").Value = 55 ' Watch : : Ws12.Range("D69").Value : 55 : Variant/Double : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("D69") = 55 ' Watch : + : Ws12.Range("D69") : 55 : Object/Range : Sheet2.RangeObjectDefaultPropertiesCell

Let Ws12.Range("C69").Value = "44" ' This does not give the Number stored as Text Thing https://i.postimg.cc/XYrvmWdH/Number-stored-as-Text-Thing.jpg Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Let Ws12.Range("C69").Value = "44" ' Watch : : "44" : "44" : String : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("C69").Value = "44" ' Watch : : Range("C69").Value : 44 : Variant/Double : Sheet2.RangeObjectDefaultPropertiesCell
Let Ws12.Range("C69") = "44" ' Watch : - : Ws12.Range("C69") : 44 : Object/Range : Sheet2.RangeObjectDefaultPropertiesCell
' : Value2 : 44 : Variant/Double : Sheet2.RangeObjectDefaultPropertiesCell
' ' https://i.postimg.cc/DyBC0ZnB/Written-Properties.jpg
' ' https://i.postimg.cc/Ghc7bYw4/Written-Properties.jpg
' ' https://i.postimg.cc/L85x1psR/Written-Properties.jpg
' ' https://i.postimg.cc/ryGZ6jb6/Written-Property-Value.jpg

' "values" The word values often refers generally to things in the cell numbers text and the formatting that can be done with just numbers and text. In other words, these following all have the same effect.
Range("A69").Clear
Let Ws12.Range("A69").Value = Split("44"): Range("A69").Clear
Let Ws12.Range("A69") = Split("44"): Range("A69").Clear
Let Ws12.Range("A69").FormulaR1C1Local = Split("44"): Range("A69").Clear
Let Ws12.Range("A69").Formula = Split("44")
' Perhaps anytime we use any of these Properties, we default to just Range =

Rem 1 Variable type considerations
Dim Rng As Range
Set Rng = Ws12.Range("A69") ' Watch : + : Rng : "44" : Range/Range : Sheet2.RangeObjectDefaultPropertiesCells
Debug.Print VarTyp(VarType(Rng)) ' String What is this String? Could it be this https://i.postimg.cc/0NWjBNHB/Number-stored-as-Text-Thing-Could-it-be-this.jpg , the "written property value" https://i.postimg.cc/ryGZ6jb6/Written-Property-Value.jpg
Dim vTemp As Variant, Str As String
Let vTemp = Rng ' Watch : : vTemp : "44" : Variant/String : Sheet2.RangeObjectDefaultPropertiesCells
Let Str = Rng ' Watch : : Str : "44" : String : Sheet2.RangeObjectDefaultPropertiesCells
' RHS
Rem 2
Let Ws12.Range("A75") = Ws12.Range("A69").Value ' https://i.postimg.cc/bYWyfPc6/Does-not-give-Number-held-as-Text-thing.jpg
Let Ws12.Range("A75") = Rng.Value ' These two lines do not result in the Number held as Text thing
' Use .Value and we put a value in the cell, like if we humans write stuff in a cell, Excel will decide if its a number or text regardless of any Number as text thing
' Actually we are doing this, The optional argument tends to support the idea that on the RHS, the .Value is a method , ( although note its only been available since Excel 2007 )
Let Ws12.Range("A75") = Rng.Value(RangeValueDataType:=xlRangeValueDefault) ' RangeValueDataType:=https://learn.microsoft.com/en-us/office/vba/api/excel.range.value https://learn.microsoft.com/en-us/office/vba/api/excel.xlrangevaluedatatype https://fastexcel.wordpress.com/2017/03/13/excel-range-valuevaluetype-what-is-this-parameter/
' we have other options, for example
Ws12.Range("B75") = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet): Let Ws12.Range("B75").WrapText = False
' https://i.postimg.cc/NF3B66kh/Value-XMLSpreadsheet.jpg

' Now it gets intersting,
Let Ws12.Range("C75") = Rng ' this DOES the Number stored as Text Thing https://i.postimg.cc/hvzKQyxb/Number-held-as-string-thing.jpg https://i.postimg.cc/XYrvmWdH/Number-stored-as-Text-Thing.jpg Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
' If you don't use .Value a range object is put in, something we human's can't do , and any Number as text stuff will be preserved
' ' Or
' 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
' https://i.postimg.cc/Xq1HsdJL/Cell-A69.jpg

Rem 3
'3a) I expect this is not defaulting to .Value Rather, VBA may be conveniently obligingly coercing the range object being returned from the RHS. saying that in a different way, if VBA gets a range object where it is not expecting one, then it might be wired to do something, such as look for an appropriate property/method to suit
Dim Var As Variant
Let Var = Rng ' Watch : : Var : "44" : Variant/String : Sheet2.RangeObjectDefaultPropertiesCells
Let Var = Ws12.Range("A75") ' Watch : : Var : 44 : Variant/Double : Sheet2.RangeObjectDefaultPropertiesCells
'3b) Although the results are the same here, I think it is working differently.
Let Var = Rng.Value ' Watch : : Var : "44" : Variant/String : Sheet2.RangeObjectDefaultPropertiesCells
Let Var = Ws12.Range("A75").Value ' Watch : : Var : 44 : Variant/Double : Sheet2.RangeObjectDefaultPropertiesCells
'3b(i) we are actually doing this https://learn.microsoft.com/en-us/office/vba/api/excel.range.value https://learn.microsoft.com/en-us/office/vba/api/excel.xlrangevaluedatatype
Let Var = Rng.Value(RangeValueDataType:=xlRangeValueDefault) ' Watch : : Var : "44" : Variant/String : Sheet2.RangeObjectDefaultPropertiesCells
''3b(ii) but we could also do this
Let Var = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet) ' Watch : : Var : "<?xml version="1.0"?>
' <?mso-application progid="Excel.Sheet"?>
' <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
' xmlns: o = "urn:schemas-microsoft-com:office:office"
' ... etc
'
' Let Var = Rng2.Value(RangeValueDataType:=xlRangeValueXMLSpre adsheet) ' Watch : : Var : "<?xml version="1.0"?>
' <?mso-application progid="Excel.Sheet"?>
' <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
' xmlns: o = "urn:schemas-microsoft-com:office:office"
' ... etc

End Sub


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-01-2023, 10:58 PM
later
.
.
.
.
.
.
..
.


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-02-2023, 02:48 PM
RangeObjectDefaultProperties(Methods?) Multiple Cell Ranges
This post does a fairly limited investigation , as the purpose is to support the issues discussed in the last posts, specifically, what default Properties/ methods /or whatever processes are going on with code line of these general forms
_________________ Range2.Value = Range1.Value
_________________ Range2 = Range1.Value
_________________ Range2.Value = Range1
_________________ Range2 = Range1
Generally we expect and experience an Array of Variant type elements returned from a range using .Value on the RHS, ( ###or so we all thought) For the purposes of clarity, we won’t discuss that issue specifically in great detail.

In the codings in the next post, we see some similar behaviour.
_ On the LHS the use of .Value or not, seems to make no difference. So that seems the same.
_ There is a difference between the .Value or not on the RHS. That fact is the same, but we don’t experience exactly the same behaviour, or perhaps we do, depending on what exactly is going on….
What happens in the case of no .Value is, well, nothing, at least nothing we can see. Strange. Or maybe not: If we compare a similar Watch Window view, to that for the single cell case,
https://i.postimg.cc/Xq1HsdJL/Cell-A69.jpg
5500 https://i.postimg.cc/T5mJwyn5/Cell-A69.jpg (https://postimg.cc/T5mJwyn5)
, for example of a two cell range, A69:B69, we see an empty space
https://i.postimg.cc/sgdHWZc7/Range-A69-B69.jpg
5501 https://i.postimg.cc/3d1Z5Nzx/Range-A69-B69.jpg (https://postimg.cc/3d1Z5Nzx)
https://i.postimg.cc/sgdHWZc7/Range-A69-B69.jpg (https://postimages.org/)



###One passing thing of interests noticed, not directly relevant to our issues:
If I use either of the other two Range value types ( ) , rather than the default, RangeValueDataType:=xlRangeValueDefault ,
RangeValueDataType:=xlRangeValueMSPersistXML
RangeValueDataType:=xlRangeValueXMLSpreadsheet
, then an array is not returned. A text is returned in an XLM format, (that does include data from all the cells in the range).



Some coding in next post .

DocAElstein
08-02-2023, 02:48 PM
Sub RangeObjectsDefaultPropertiesCells() ' https://www.excelfox.com/forum/showthread.php/2914-Tests-and-Notes-on-Range-objects-in-Excel-Cell?p=23181&viewfull=1#post23181
Rem 0 ' Test data range
Dim Ws12 As Worksheet: Set Ws12 = ThisWorkbook.Worksheets.Item("Sheet1 (2)")
Ws12.Range("A80:D80").Clear ' .Clear to get rid of all valiues and any formats
Ws12.Range("A69:B69").Clear
Let Ws12.Range("A69").Value = Split("44") ' ' Gives Number held as text thing (https://i.postimg.cc/d1b7M9hG/Number-held-as-string-thing.jpg)
Let Ws12.Range("B69").Value = "42" ' does not gives "
Rem 1
Dim Rng As Range
Set Rng = Ws12.Range("A69:B69") ' Watch : + : Rng : : Range/Range : Sheet2.RangeObjectsDefaultPropertiesCells
' + : Value2 : : Variant/Variant(1 to 1, 1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' + : Value2(1) : : Variant(1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' : Value2(1,1) : "44" : Variant/String : Sheet2.RangeObjectsDefaultPropertiesCells
' : Value2(1,2) : 42 : Variant/Double : Sheet2.RangeObjectsDefaultPropertiesCells
Debug.Print VarTyp(VarType(Rng)) ' Array of Variant type Elements
Dim vTemp As Variant, Str As String
Let vTemp = Rng ' Watch : + : vTemp : : Variant/Variant(1 to 1, 1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' + : vTemp(1) : : Variant(1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' : vTemp(1,1) : "44" : Variant/String : Sheet2.RangeObjectsDefaultPropertiesCells
' : vTemp(1,2) : 42 : Variant/Double : Sheet2.RangeObjectsDefaultPropertiesCells
' Let Str = Rng ' Runtime error 14 Type mismatch
Rem 2
Let Ws12.Range("A80") = Rng: Ws12.Range("A80").Value = Rng ' Nothing seems to have been done
Debug.Print VarType(Ws12.Range("A80")) ' 0
Debug.Print VarType(Ws12.Range("A80").Value) ' 0
Debug.Print VarTyp(VarType(Ws12.Range("A80"))) ' Empty
Debug.Print VarTyp(VarType(Ws12.Range("A80").Value)) ' Empty
' Note that we see an empty space here : https://i.postimg.cc/sgdHWZc7/Range-A69-B69.jpg https://i.postimg.cc/sgdHWZc7/Range-A69-B69.jpg

Let Ws12.Range("A81") = Rng.Value ' Watch : + : Ws12.Range("A81") : 44 : Object/Range : Sheet2.RangeObjectsDefaultPropertiesCells
Ws12.Range("A81").Clear
Ws12.Range("A81").Value = Rng.Value ' Watch : : Range("A81").Value : 44 : Variant/Double : Sheet2.RangeObjectsDefaultPropertiesCells
Debug.Print VarTyp(VarType(Ws12.Range("A81").Value)) ' Double-precision floating-point number
Debug.Print VarTyp(VarType(Rng.Value)) ' Array of Variant type Elements

Let Ws12.Range("A82").Value = Rng.Value(RangeValueDataType:=xlRangeValueDefault)
' Watch : : Ws12.Range("A82").Value : 44 : Variant/Double : Sheet2.RangeObjectsDefaultPropertiesCells
' Watch : + : Rng.Value(RangeValueDataType:=xlRangeValueDefault) : : Variant/Variant(1 to 1, 1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' + : Rng.Value(RangeValueDataType:=xlRangeValueDefault) (1) : : Variant(1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' : Rng.Value(RangeValueDataType:=xlRangeValueDefault) (1,1) : "44" : Variant/String : Sheet2.RangeObjectsDefaultPropertiesCells
' : Rng.Value(RangeValueDataType:=xlRangeValueDefault) (1,2) : 42 : Variant/Double : Sheet2.RangeObjectsDefaultPropertiesCells

Ws12.Range("A82").Clear: Ws12.Range("A82") = Rng.Value(RangeValueDataType:=xlRangeValueDefault)
' Watch : + : Ws12.Range("A82") : 44 : Object/Range : Sheet2.RangeObjectsDefaultPropertiesCells
Let Ws12.Range("A83").Value = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet)
' Watch : : Ws12.Range("A83").Value : "<?xml version="1.0"?> : Varinat/String
' <?mso-application progid="Excel.Sheet"?>
' <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
' xmlns: o = "urn:schemas-microsoft"
' ... etc.
Let Ws12.Range("A83").WrapText = False: Ws12.Range("A83").Clear
Let Ws12.Range("A83") = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet): Let Ws12.Range("A83").WrapText = False
' Watch : + : Ws12.Range("A83") : "<?xml version="1.0"?> : Variant/String
' <?mso-application progid="Excel.Sheet"?>
' <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
' xmlns: o = "urn:schemas-microsoft-com:o"
'
'
' Watch : : Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet) : "<?xml version="1.0"?>
' <?mso-application progid="Excel.Sheet"?>
' <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet
' Strange its not showing an array
Let Ws12.Range("A84:B84") = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet): Ws12.Range("A84:B84").WrapText = False
' and not producing one either - It puts the same value in both cells
Let Ws12.Range("A84:B84").Value = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet) ' : Ws12.Range("A84:B84").WrapText = False
' (The behaviour of Range2.Value = or Range2 = making no difference is still apparant for RangeValueDataType:=xlRangeValueXMLSpreadsheet )

Ws12.Range("A84:B84").WrapText = False
Let vTemp = Rng.Value ' Watch : - : vTemp : : Variant/Variant(1 to 1, 1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' + : vTemp(1) : : Variant(1 to 2) : Sheet2.RangeObjectsDefaultPropertiesCells
' : vTemp(1,1) : "44" : Variant/String : Sheet2.RangeObjectsDefaultPropertiesCells
' : vTemp(1,2) : 42 : Variant/Double : Sheet2.RangeObjectsDefaultPropertiesCells
Let vTemp = Rng.Value() ' Watch as above "
Let vTemp = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet) ' Watch : : vTemp : "<?xml version="1.0"?>
' <?mso-application progid="Excel.Sheet"?>
' <Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
' xmlns: o = "urn:schemas-microsoft-com:office:office"
' ....etc...
Debug.Print vTemp
'<?xml version="1.0"?>
'<?mso-application progid="Excel.Sheet"?>
'<Workbook xmlns="urn:schemas-microsoft-com:office:spreadsheet"
'xmlns: o = "urn:schemas-microsoft-com:office:office"
'xmlns: x = "urn:schemas-microsoft-com:office:excel"
'xmlns: ss = "urn:schemas-microsoft-com:office:spreadsheet"
' xmlns:html="http://www.w3.org/TR/REC-html40">
' <Styles>
' <Style ss:ID="Default" ss:Name="Normal">
' <Alignment ss:Vertical="Bottom"/>
' <Borders/>
' <Font ss:FontName="Arial"/>
' <Interior/>
' <NumberFormat/>
' <Protection/>
' </Style>
' <Style ss:ID="s67">
' <Alignment ss:Vertical="Bottom" ss:WrapText="1"/>
' </Style>
' </Styles>
' <Worksheet ss:Name="Sheet1 (2)">
' <Table ss:ExpandedColumnCount="2" ss:ExpandedRowCount="1"
' ss:DefaultColumnWidth="49.5">
' <Column ss:AutoFitWidth="0" ss:Width="371.25"/>
' <Column ss:StyleID="s67" ss:AutoFitWidth="0" ss:Width="348"/>
' <Row>
' <Cell><Data ss:Type="String">44</Data></Cell>
' <Cell ss:StyleID="Default"><Data ss:Type="Number">42</Data></Cell>
' </Row>
' </Table>
' </Worksheet>
'</Workbook>
Let Str = Rng.Value(RangeValueDataType:=xlRangeValueXMLSprea dsheet)
' Let Str = Rng.Value() ' Type mismatch
Let Str = Rng.Value(RangeValueDataType:=xlRangeValueMSPersis tXML)
Debug.Print Str
'<xml xmlns:x="urn:schemas-microsoft-com:office:excel"
'xmlns: dt = "uuid:C2F41010-65B3-11d1-A29F-00AA00C14882"
'xmlns: s = "uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882"
' xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema">
' <x:PivotCache>
' <x:CacheIndex>1</x:CacheIndex>
' <s:Schema id="RowsetSchema">
' <s:ElementType name="row" content="eltOnly">
' <s:attribute type="Col1"/>
' <s:attribute type="Col2"/>
' <s:extends type="rs:rowbase"/>
' </s:ElementType>
' <s:AttributeType name="Col1" rs:name="Feld1">
' <s:datatype dt:maxLength="255"/>
' </s:AttributeType>
' <s:AttributeType name="Col2" rs:name="Feld2">
' <s:datatype dt:type="int"/>
' </s:AttributeType>
' </s:Schema>
' <rs:data>
' <z:row Col1="44" Col2="42"/>
' </rs:data>
' </x:PivotCache>
'</xml>

End Sub
.
.
.

https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-06-2023, 04:53 PM
later....

.
..
.
.
.
.
.
.
.
.

later
.
.
.
.
.
.
.
.
..


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=ySENWFIkL7c (https://www.youtube.com/watch?v=ySENWFIkL7c)
https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg (https://www.youtube.com/watch?v=ySENWFIkL7c&lc=UgyqIYcMnsUQxO5CVyx4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI (https://www.youtube.com/watch?v=yVgLmj0aojI)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgwWg8x2WxLSxxGsUP14AaABAg.9k3ShckGnhv9k89Lsaig oO)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2 (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxxxIaK1pY8nNvx6JF4AaABAg.9k-vfnj3ivI9k8B2r_uRa2)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=UgxKFXBNd6Pwvcp4Bsd4AaABAg)
https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg (https://www.youtube.com/watch?v=yVgLmj0aojI&lc=Ugw9X6QS09LuZdZpBHJ4AaABAg)
https://www.youtube.com/watch?v=vXyMScSbhk4 (https://www.youtube.com/watch?v=vXyMScSbhk4)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgynOSp1dleo-Z8L_QN4AaABAg.9jJLDC1Z6L-9k68CuL4aTY)
https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ (https://www.youtube.com/watch?v=vXyMScSbhk4&lc=UgwV5N_ulFXYMNbyQG54AaABAg.9itCkoVN4w79itOVYVvE wQ)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)

DocAElstein
08-14-2023, 04:44 PM
later




.
.
.
.
.
.
.
.
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jdPeMPT98QU (https://www.youtube.com/watch?v=jdPeMPT98QU)
https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg (https://www.youtube.com/watch?v=QdwDnUz96W0&lc=Ugx3syV3Bw6bxddVyBx4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgxsozCmRd3RAmIPO5B4AaABAg.9fxrOrrvTln9g9wr8mv2 CS)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g96yGbAX 4t)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9g7pczEpcTz)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=UgyT1lo2YMUyZ50bLeR4AaABAg.9fz3_oaiUeK9g7lhoX-ar5)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gD0AA-sfpl )
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugx5d-LrmoMM_hsJK2N4AaABAg.9fyL20jCtOI9gECpsAVGbh)
https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2 (https://www.youtube.com/watch?v=U76ZRIzBhOA&lc=Ugw6zxOMtNCfmdllKQl4AaABAg.9g9wJCunNRa9gJGhDZ4R I2)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)


https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)
https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg (https://www.youtube.com/watch?v=jTmVtPHtiTg&lc=Ugy_RiNN_kAqUvZ8W994AaABAg)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1 (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNsaS3Lp1)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgR1EPUkhw)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNe_XC-jK)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgNPOdiDuv)
https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc (https://www.youtube.com/watch?v=QjEWAJ3d-jw&lc=UgxJLVpwY8fIla7G-pN4AaABAg.9BLeCWVhxdG9wgN7AC7wAc)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg)
https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg (https://www.youtube.com/watch?v=DVFFApHzYVk&lc=Ugyi578yhj9zShmhuPl4AaABAg)
https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg (https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgxvxlnuTRWiV6MUZB14AaABAg)
https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg (https://www.youtube.com/watch?v=_8i1fVEi5WY&lc=Ugz0ptwE5J-2CpX4Lzh4AaABAg)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg.9C-br0lEl8V9xI0_6pCaR9 (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxoHAw8RwR7VmyVBUt4AaABAg.9C-br0lEl8V9xI0_6pCaR9)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg.9bl7m03Onql9xI-ar3Z0ME (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=Ugz5DDCMqmHLeEjUU8t4AaABAg.9bl7m03Onql9xI-ar3Z0ME)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg.9gdrYDocLIm9xI-2ZpVF-q (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgxYnpd9leriPmc8rPd4AaABAg.9gdrYDocLIm9xI-2ZpVF-q)
https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg.9id_Q3FO8Lp9xHyeYSuv 1I (https://www.youtube.com/watch?v=0ltJS7uHfK4&lc=UgyjoPLjNeIAOMVH_u94AaABAg.9id_Q3FO8Lp9xHyeYSuv 1I)
https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3 (https://www.reddit.com/r/windowsxp/comments/pexq9q/comment/k81ybvj/?utm_source=reddit&utm_medium=web2x&context=3)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgxYgiEZuS9I3xkjJv54AaABAg)
https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M (https://www.youtube.com/watch?v=bs-urI_o8jo&lc=UgyBACXgNY4j_cHgH5J4AaABAg.9oTkVdzfqfm9wlhQrYJP 3M)
ttps://www.youtube.com/watch?v=LP9fz2DCMBE (ttps://www.youtube.com/watch?v=LP9fz2DCMBE)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg)
https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8 (https://www.youtube.com/watch?v=LP9fz2DCMBE&lc=UgzbPgJUMCztIOQDym14AaABAg.9wdo_rWgxSH9wdpcYqrv p8)
ttps://www.youtube.com/watch?v=bFxnXH4-L1A (ttps://www.youtube.com/watch?v=bFxnXH4-L1A)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxuODisjo6cvom7O-B4AaABAg.9w_AeS3JiK09wdi2XviwLG)
https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg (https://www.youtube.com/watch?v=bFxnXH4-L1A&lc=UgxBU39bTptFznDC1PJ4AaABAg)
ttps://www.youtube.com/watch?v=GqzeFYWjTxI (ttps://www.youtube.com/watch?v=GqzeFYWjTxI)
https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg (https://www.youtube.com/watch?v=GqzeFYWjTxI&lc=UgwJnJDJ5JT8hFvibt14AaABAg)
https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA (https://www.youtube.com/channel/UCnxwq2aGJRbjOo_MO54oaHA)