is this left() VBA or Worksheet function

lezawang

Well-known Member
Joined
Mar 27, 2016
Messages
1,805
Office Version
  1. 2016
Platform
  1. Windows
Hi
I am reading about dealing with text in VBA (the link below) and I see code similar to the one below. My question, this left() function is VBA native or Worksheet function. My guess is VBA native. Thanks a lot.

Code:
Sub myleft()
    Dim x As String
    Dim y As String
    x = InputBox("enter phone number")
    y = Left(x, 3)
    MsgBox "your area code is  " & y
End Sub

https://www.excel-easy.com/vba/string-manipulation.html
 

Excel Facts

Repeat Last Command
Pressing F4 adds dollar signs when editing a formula. When not editing, F4 repeats last command.
It is VBA else it would be WorksheetFunction.Left although I can't think of any difference between the 2 bar a miniscule speed difference.
 
Last edited:
Upvote 0
What happens if you put your code from Post #1 in a module, highlight the word "Left" and push your F1 key?
If it is a WorksheetFunction, it will say so in the pop-up screen.
 
Upvote 0
Thank you all. The F1 trick is amazing. Thanks all once again
 
Upvote 0
What happens if you put your code from Post #1 in a module, highlight the word "Left" and push your F1 key?
You do not have to put the keyword in a module... this will work the same if you put the keyword in the Immediate Window as well. Also, it is not necessary to highlight the entire word... just clicking in the word or immediately next to the word would be sufficient.
 
Upvote 0
You do not have to put the keyword in a module... this will work the same if you put the keyword in the Immediate Window as well. Also, it is not necessary to highlight the entire word... just clicking in the word or immediately next to the word would be sufficient... and then press the F1 key.
I forgot to include the red highlighted text in my original post.
 
Upvote 0
Hi Rick.
Thanks for the clarification.
There are a lot of roads that lead to Rome but the most important thing is to get there and quite often it does not really matter how while at other times it does.
 
Upvote 0

Forum statistics

Threads
1,223,911
Messages
6,175,324
Members
452,635
Latest member
laura12345

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top