Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declaring variables

Status
Not open for further replies.

robbo666

Technical User
Jan 6, 2010
4
AU
I am set up a number of variables which will then be fed into a dynamic array.
Each of the array elements need to be a specific length and
I can set the string ones like so
Dim stringe1 As String * 15
(setting the length at 15)
How do the same for numerics

I can format a numberic variable like so
number=Format(shtUpload.Cells(5, 16), "0000.00")
but can I do something similar with "Dim
 



Hi,

Numbers don't get defined in Character LENGTHS.

You have Integer (2 bytes) -32,768 to 32,767, Long (4 bytes) 2,147,483,648 to 2,147,483,647, Single (4-byte) -3.402823E38 to -1.401298E-45, Double (8-byte) -1.79769313486231E308 to -4.94065645841247E-324, Currency (8 byte) -922,337,203,685,477.5808 to 922,337,203,685,477.5807.

Your example does not return a NUMBER. It returns TEXT.
Code:
number=Format(shtUpload.Cells(5, 16), "0000.00")
msgbox number
and observe the 'number' in QUOTES as a string.

What is the PURPOSE of this requirement?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Effectively, what I'm trying to do is set the format of array elements
 
and what problem are you encountering?

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
Okay..next question :)
Is there a VBA equivalent of this VB snippet
========================
VERSION 1.0 CLASS
BEGIN
MultiUse = -1 'True
Persistable = 0 'NotPersistable
DataBindingBehavior = 0 'vbNone
DataSourceBehavior = 0 'vbNone
MTSTransactionMode = 0 'NotAnMTSObject
END
Attribute VB_Name = "UnboundedArray"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = True
Attribute VB_PredeclaredId = False
Attribute VB_Exposed = False
=========================
Thanks
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top