WorksheetFunction.Left problem

  • Thread starter Thread starter LuisE
  • Start date Start date
L

LuisE

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

How can i get the formula above to work?
Thanks in advance.
 
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
 
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
 
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
 
Back
Top