From: kylefoley2000 on
what does chr$ mean in this code

Sub rick()
Dim strabc(1 To 26) As String
Dim i As Integer
Dim strprompt As String
For i = 1 To 26
strabc(i) = Chr$(i + 64)
Next i
strprompt = "hey:" & vbCrLf
For i = 1 To 26
strprompt = strprompt & strabc(i)
Next i
MsgBox strprompt


End Sub
From: Chip Pearson on
When a $ character is at the end of a string function such as Chr, it
tells VBA to use the String, as opposed to the Variant, version of
the function. In most respects, it is irrrelevant whether you use the
$ version of the function.

Cordially,
Chip Pearson
Microsoft Most Valuable Professional,
Excel, 1998 - 2010
Pearson Software Consulting, LLC
www.cpearson.com





On Sat, 3 Apr 2010 15:41:01 -0700, kylefoley2000
<kylefoley2000(a)discussions.microsoft.com> wrote:

>what does chr$ mean in this code
>
>Sub rick()
>Dim strabc(1 To 26) As String
>Dim i As Integer
>Dim strprompt As String
>For i = 1 To 26
> strabc(i) = Chr$(i + 64)
>Next i
>strprompt = "hey:" & vbCrLf
>For i = 1 To 26
> strprompt = strprompt & strabc(i)
>Next i
>MsgBox strprompt
>
>
>End Sub
From: Joe User on
"kylefoley2000" wrote:
> what does chr$ mean in this code

It's superfluous.

Putting "$" after a variable name ensures that it is treated as String
variable, even if it is not declared as such (and it is not declared as
something else, and it Option Explicit is not declared).

But putting "$" after a function name has not functional value since
functions, especially intrinsic VBA functions, are typed explicitly.

However, some people might argue that putting "$" after any name is
self-documenting. That is, it makes it clearer to the reader what the code
is doing.

There are many other date-type suffixes. "%" for Integer; "#" for Double;
and "@" for Currency, to name a view. These numeric suffixes are especially
useful following constants.


----- original message -----

"kylefoley2000" wrote:

> what does chr$ mean in this code
>
> Sub rick()
> Dim strabc(1 To 26) As String
> Dim i As Integer
> Dim strprompt As String
> For i = 1 To 26
> strabc(i) = Chr$(i + 64)
> Next i
> strprompt = "hey:" & vbCrLf
> For i = 1 To 26
> strprompt = strprompt & strabc(i)
> Next i
> MsgBox strprompt
>
>
> End Sub
From: Bob Phillips on
Looking this up in VBA help we get

Returns a String containing the character associated with the specified
character code.

--

HTH

Bob

"kylefoley2000" <kylefoley2000(a)discussions.microsoft.com> wrote in message
news:8C228318-C238-4DCA-B282-CB949990CB6F(a)microsoft.com...
> what does chr$ mean in this code
>
> Sub rick()
> Dim strabc(1 To 26) As String
> Dim i As Integer
> Dim strprompt As String
> For i = 1 To 26
> strabc(i) = Chr$(i + 64)
> Next i
> strprompt = "hey:" & vbCrLf
> For i = 1 To 26
> strprompt = strprompt & strabc(i)
> Next i
> MsgBox strprompt
>
>
> End Sub


From: kylefoley2000 on
great answer, thank you for your dedication and support

"Joe User" wrote:

> "kylefoley2000" wrote:
> > what does chr$ mean in this code
>
> It's superfluous.
>
> Putting "$" after a variable name ensures that it is treated as String
> variable, even if it is not declared as such (and it is not declared as
> something else, and it Option Explicit is not declared).
>
> But putting "$" after a function name has not functional value since
> functions, especially intrinsic VBA functions, are typed explicitly.
>
> However, some people might argue that putting "$" after any name is
> self-documenting. That is, it makes it clearer to the reader what the code
> is doing.
>
> There are many other date-type suffixes. "%" for Integer; "#" for Double;
> and "@" for Currency, to name a view. These numeric suffixes are especially
> useful following constants.
>
>
> ----- original message -----
>
> "kylefoley2000" wrote:
>
> > what does chr$ mean in this code
> >
> > Sub rick()
> > Dim strabc(1 To 26) As String
> > Dim i As Integer
> > Dim strprompt As String
> > For i = 1 To 26
> > strabc(i) = Chr$(i + 64)
> > Next i
> > strprompt = "hey:" & vbCrLf
> > For i = 1 To 26
> > strprompt = strprompt & strabc(i)
> > Next i
> > MsgBox strprompt
> >
> >
> > End Sub