• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

Dim - As string

"Dim RepID(1000) As String"

For the above formula, please advice if it states that the max value of "RepID" is 1000?

Thanks & Regards,
 
Hi Assish,

Very debate starter and confusing query..

* Do you want an Array variable, array size 1000, and in any location stored data "1001" will be treated as String not Integer and String's Character length (*1000) is not fixed.. then above is the line to dimensionize..

so my simple answer is NO.. that doesn't state that max value of "RepID" is 1000..
but i have give you enough clue to write your query again..

BTW.. Formula.. ???
this is VBA Macro SubForum.. :)


And the worst part it's that this doesn't seem to be the 1st time with this OP.
 
The line Dim RepID(1000) As String
sets up an Array called RepID and assigns 1000 vacant slots to it
Each slot can store data of data type String

The slots will be numbered RepID(0) to RepID(999)
unless you have used the Option Base 1 qualifier at the top of the module
In which case the slots will be numbered RepID(1) to RepID(1000)

If you want you can use the line
Dim RepID(1 to 1000) As String
Which forces the lower array value to be 1

The 1000 has nothing to do with the length of the string or the size of a number stored in the array
Numbers placed in the array will be stored as Strings
 
Hi, Ashish Batham!

Give a look at the uploaded file. I apologize for the language but I use a Spanish Excel version.

You might be wondering where have I found it and how deep should I have dug to reach that. Well, I'll tell you:
- Start a new Excel instance (i.e., open Excel)
- Enter into the Visual Basic Editor (i.e, Alt-F11 or Programmer tab, Code group, Visual Basic icon)
- Type Dim in the immediate window pane (if not visible, press Ctrl-G)
- Position the cursor over/into the typed word (i.e., between the "D" and the "i" or between the "i" and the "m")
- Press the help key (i.e., F1)
... et voilá, c'est tout!

Hope it helps. And don't forget to click on the sample links or also read/see links.

Regards!

PS: No need to say that this magic procedure works for every VBA reserved word (function, object, method, property, etc.), need it?
 

Attachments

  • Dim - As string (for Ashish Batham at chandoo.org).png
    Dim - As string (for Ashish Batham at chandoo.org).png
    191.9 KB · Views: 2
Back
Top