ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   document for VBA (https://www.excelbanter.com/excel-programming/323936-document-vba.html)

[email protected]

document for VBA
 
dear members of group
I am moving to work with VBA and I dont know where can i have defintion
and help for function/variable type that I find in VBA. When I use help
of VBA editor (included in Excel for example) I could not find proper
definition of Variant type. Could you help me with that?
XS


Tom Ogilvy

document for VBA
 
This is what they have in help:
Variant Data Type
The Variant data type is the data type for all variables that are not
explicitly declared as some other type (using statements such as Dim,
Private, Public, or Static). The Variant data type has no type-declaration
character.

A Variant is a special data type that can contain any kind of data except
fixed-length String data. (Variant types now support user-defined types.) A
Variant can also contain the special values Empty, Error, Nothing, and Null.
You can determine how the data in a Variant is treated using the VarType
function or TypeName function.

Numeric data can be any integer or real number value ranging
from -1.797693134862315E308 to -4.94066E-324 for negative values and from
4.94066E-324 to 1.797693134862315E308 for positive values. Generally,
numeric Variant data is maintained in its original data type within the
Variant. For example, if you assign an Integer to a Variant, subsequent
operations treat the Variant as an Integer. However, if an arithmetic
operation is performed on a Variant containing a Byte, an Integer, a Long,
or a Single, and the result exceeds the normal range for the original data
type, the result is promoted within the Variant to the next larger data
type. A Byte is promoted to an Integer, an Integer is promoted to a Long,
and a Long and a Single are promoted to a Double. An error occurs when
Variant variables containing Currency, Decimal, and Double values exceed
their respective ranges.

You can use the Variant data type in place of any data type to work with
data in a more flexible way. If the contents of a Variant variable are
digits, they may be either the string representation of the digits or their
actual value, depending on the context. For example:

Dim MyVar As Variant
MyVar = 98052
In the preceding example, MyVar contains a numeric representation-the actual
value 98052. Arithmetic operators work as expected on Variant variables that
contain numeric values or string data that can be interpreted as numbers. If
you use the + operator to add MyVar to another Variant containing a number
or to a variable of a numeric type, the result is an arithmetic sum.

The value Empty denotes a Variant variable that hasn't been initialized
(assigned an initial value). A Variant containing Empty is 0 if it is used
in a numeric context and a zero-length string ("") if it is used in a string
context.

Don't confuse Empty with Null. Null indicates that the Variant variable
intentionally contains no valid data.

In a Variant, Error is a special value used to indicate that an error
condition has occurred in a procedure. However, unlike for other kinds of
errors, normal application-level error handling does not occur. This allows
you, or the application itself, to take some alternative action based on the
error value. Error values are created by converting real numbers to error
values using the CVErr function.



-----------------------



type variant in a module, highlight it and hit F1.



--

Regards,

Tom Ogilvy



wrote in message
oups.com...
dear members of group
I am moving to work with VBA and I dont know where can i have defintion
and help for function/variable type that I find in VBA. When I use help
of VBA editor (included in Excel for example) I could not find proper
definition of Variant type. Could you help me with that?
XS




[email protected]

document for VBA
 
can you show me how can I get this help?
Do you know how to assign a name locally to a range in a sheet. I know
how to do it globally with Insert-Name-Define but dont know how to
define a local name for a range.
XS


Tom Ogilvy

document for VBA
 
At the end of the post I said

in a module put in

variant

highlight it and hit F1

--------------

Insert = Name = Define

when you assign the name, use the sheet name as well

name: Sheet1!MyName
Refersto: =Sheet1!$A$1:$A$10

as an example.

--
Regards,
Tom Ogilvy

wrote in message
oups.com...
can you show me how can I get this help?
Do you know how to assign a name locally to a range in a sheet. I know
how to do it globally with Insert-Name-Define but dont know how to
define a local name for a range.
XS




[email protected]

document for VBA
 
thank very much,
it seem that our News-Connected distribution are strongly correlated.
Thank for this help!
XS


[email protected]

document for VBA
 
Now, the inverse question: how can I remove a name that I ve created? I
can find how to do it
XS


Tom Ogilvy

document for VBA
 
ThisWorkbook.Names("MyName").Delete

--
Regards,
Tom Ogilvy

wrote in message
ups.com...
Now, the inverse question: how can I remove a name that I ve created? I
can find how to do it
XS




[email protected]

document for VBA
 
given the Short Cut, how can I know which Macro is called?
XS



All times are GMT +1. The time now is 05:46 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com