WorksheetFunction.Left problem

L

LuisE

Application.WorksheetFunction.Left(Cells(variable , 1 ) ,9)

How can i get the formula above to work?
Thanks in advance.
 
J

Jacob Skaria

Since the same function is available with VBScript you can use it directly.
For example.

Msgbox Left("John",2) returns "Jo"

If this post helps click Yes
 
R

RB Smissaert

Using the string function Left$ is faster and that may be important if it is
run in a loop.

Left$(Cells(variable, 1), 9)


RBS
 
R

Ron Rosenfeld

Application.WorksheetFunction.Left(Cells(variable , 1 ) ,9)

How can i get the formula above to work?
Thanks in advance.

You cannot as written.

Left is NOT a member of the WorksheetFunction object.

VBA includes Left as a built-in function. Hence there is no reason for it also
to be included in the WorksheetFunction object.

You can discover this by looking at the prompts that occur when you type
commands in VBA; using the object browser; or using the HELP facility.

Instead, try:

Left(Cells(variable , 1 ) ,9)
--ron
 
Top