Vijaychitra
New Member
Hi,
I'm new to VB Macro.. Need help to solve
When used trim function in excel : TRIM(LEFT(A2,(FIND("-",A2,1)-1)) the desired result is obtained.
However, When used in the below format, error is thrown
Range("B2:B").Formula = "=TRIM(LEFT(A2,(FIND("-",A2,1)-1))"
I would like to know how this TRIM can be used in VBA or any other alternatives
I'm new to VB Macro.. Need help to solve
A | B |
| Raw Data | Name (Expected result) |
| John-143-Accounts | John |
| Amy-102-IT | Amy |
| Bill-158-Marketing | Bill |
| Jack-198-Sales | Jack |
| Henry-147-IT | Henry |
When used trim function in excel : TRIM(LEFT(A2,(FIND("-",A2,1)-1)) the desired result is obtained.
However, When used in the below format, error is thrown
Range("B2:B").Formula = "=TRIM(LEFT(A2,(FIND("-",A2,1)-1))"
I would like to know how this TRIM can be used in VBA or any other alternatives