Home |
Search |
Today's Posts |
#4
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
See inline comments...
Okay... I don't really feel that was necessary to answer the question. Well, if you had any reason at all for including the last paragraph in your original posting, then you are wrong... your actual code is quite material to helping with that part of your message. does: Dim ThisVar as String ThisVar = "ABCDEF" take more memory than this: Dim ThisVar as String * 6 ThisVar = "ABCDEF" If you really think you need to see an answer to the above question, here is how Microsoft describes it a this link... http://msdn.microsoft.com/en-us/library/dd942824.aspx Declare String Data Intelligently ================================================== ====== Visual Basic allocates stack and heap memory differently according to the type of strings you create. By understanding how this works, you can write more efficient string code. String variables in procedures that are non-static use space on the computer's stack. Use the following information to write code that minimizes stack memory usage. Local fixed-length strings less than or equal to 64 characters use 2 bytes for each character in the string. They don't use heap memory. Local fixed-length strings longer than 64 characters use 4 bytes of stack memory for a pointer to the variable in heap memory and 2 bytes of heap memory for each character in the string.Local variable-length strings use 4 bytes of stack memory for a pointer to the variable in heap memory, and a variable amount of heap memory according to the length of the string. If your code used a large number of fixed-length strings of 64 characters or less, you can reduce stack usage by changing the strings to local variable-length strings or making them static fixed-length strings. The entirety of the code in question is 221 lines long, and no, this is not a direct excerpt. A direct excerpt isn't necessary to answer the question, since the question is not about code, but how Excel handles variable declaration. Again, I have to wonder why you went out of your way to include the last paragraph in your original posting. Variable memory usage is not where long processing time comes from... it comes directly from the method of coding used to process the strings (no matter whether they are fixed or variable in length). -- Rick (MVP - Excel) |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Call Variables by String | Excel Programming | |||
Call Variables by String | Excel Programming | |||
String variables | New Users to Excel | |||
Parse String into Variables | Excel Programming | |||
String Variables | Excel Programming |