View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Ron Coderre Ron Coderre is offline
external usenet poster
 
Posts: 698
Default Left vs Left$ function

I don't recall Excel having a LEFT$() worksheet function, BUT it is used in
VBA.

Here's the differece (as I understand it)

LEFT(string, num_chars) returns a VARIANT.

But, in LEFT$(string, num_chars), the trailing dollar sign ($) declares the
return value to be a STRING.

It would make a difference if the 1st argument could be null.

Example:
In the immediate window of the VB Editor....

If you enter DEBUG.PRINT LEFT(NULL,3)
This is returned: NULL

But, if you enter DEBUG.PRINT LEFT$(NULL,3)
you get this error: "Invalid use of null",
because a STRING cannot be null.

Does that help?
***********
Regards,
Ron

XL2002, WinXP


"Andy" wrote:

Can someone explain the difference between the two of these? Thanks!