LEFT function in VB 6.0

Please tell me how would I convert code below from VBA to VB6.0


Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Guy Hengel [angelIII / a3]Billing EngineerCommented:
what should the following part of the expression do:
because that is not valid.

please explain.
Not sure what that command is supposed to do in vba...

a2 * 10^(len(a2)-1)

may be what youre after?
Mike TomlinsonMiddle School Assistant TeacherCommented:
The Left() function is used to extract a certain number of characters from the Left side of a String.  In your example, it's use doesn't make any sense...

Can you explain in PLAIN ENGLISH what you are trying to compute?  ...and/or explain the process of computing it...
The Ultimate Tool Kit for Technolgy Solution Provi

Broken down into practical pointers and step-by-step instructions, the IT Service Excellence Tool Kit delivers expert advice for technology solution providers. Get your free copy for valuable how-to assets including sample agreements, checklists, flowcharts, and more!

AiyshaAuthor Commented:
left shoud take the leftmost character.. in my example about left should be 2.. Please paste this function in excel spreadsheet and see for your self what this function does..Its a way of rounding a number to its closest 1s,10s,100th, or 1000th..

Thank you.

newString= left(int(a2),1) * (10^(len(int(a2))-1))
Guy Hengel [angelIII / a3]Billing EngineerCommented:
Guy Hengel [angelIII / a3]Billing EngineerCommented:
indeed, excel's LEFT takes 1 as default value for the lenght parameter.
vba does not have a default, hence you need to give that value explicitely
Mike TomlinsonMiddle School Assistant TeacherCommented:
Another one...

    Dim A2 As Double
    A2 = 2367.25
    Dim rounded As Integer
    rounded = (Left(A2, 1) + 1) * (10 ^ (Len(CStr(Int(A2))) - 1))
    Debug.Print rounded

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Visual Basic Classic

From novice to tech pro — start learning today.