Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Trim and Application.worksheetfunction.Trim
Hi,
Not really a doubt... Just curious as to why Microsoft has made 2 functions available in VBA, with same name but with different results. VBA trim is concerned only with leading spaces, while App.Wkshfunction.trim removes all spaces (except a single space between words). If the end results are different then, shouldnt the name of the functions be different. -- Thanks a lot, Hari India |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Trim and Application.worksheetfunction.Trim
Apples and Oranges.
Trim() is a VBA function. It exists in any VBA environment (including VB). The XL TRIM() function, exposed in VBA through Application.WorksheetFunction.Trim(), is independent of (and preceded) VBA. In cases where a VBA function does the same thing as an application function, the application function isn't exposed, e.g., DATE() isn't exposed since DateSerial() performs the same function. Since TRIM() and Trim behave differently, TRIM is exposed. Similarly, Application.WorksheetFunction.Round() is exposed since ROUND() and VBA's Round() return different results when the least significant digit is 5. In article , "Hari Prasadh" wrote: Not really a doubt... Just curious as to why Microsoft has made 2 functions available in VBA, with same name but with different results. VBA trim is concerned only with leading spaces, while App.Wkshfunction.trim removes all spaces (except a single space between words). If the end results are different then, shouldnt the name of the functions be different. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Trim and Application.worksheetfunction.Trim
Excel and VBA are two separate products that have been brought together.
The trim function or equivalent is found in most programming languages and functions pretty much as VBA's trim function. Excel, developed as a separate product, had a trim function before the interface to VBA was introduced in xl5. Round, introduced in VBA6, works differently than the round function found in Excel. I am sure there are others that don't come immediately to mind. Replace (VBA) and Substitute (Excel) work very similarly, but don't have the same name. I think you will just have to learn the distinctions. -- Regards, Tom Ogilvy "Hari Prasadh" wrote in message ... Hi, Not really a doubt... Just curious as to why Microsoft has made 2 functions available in VBA, with same name but with different results. VBA trim is concerned only with leading spaces, while App.Wkshfunction.trim removes all spaces (except a single space between words). If the end results are different then, shouldnt the name of the functions be different. -- Thanks a lot, Hari India |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA Trim and Application.worksheetfunction.Trim
Hi JE M and Tom,
Thanx a lot for the nice explanations you have given to me. Highly informative. Would remain wary of Round as well. -- Regards, Hari India "Tom Ogilvy" wrote in message ... Excel and VBA are two separate products that have been brought together. The trim function or equivalent is found in most programming languages and functions pretty much as VBA's trim function. Excel, developed as a separate product, had a trim function before the interface to VBA was introduced in xl5. Round, introduced in VBA6, works differently than the round function found in Excel. I am sure there are others that don't come immediately to mind. Replace (VBA) and Substitute (Excel) work very similarly, but don't have the same name. I think you will just have to learn the distinctions. -- Regards, Tom Ogilvy "Hari Prasadh" wrote in message ... Hi, Not really a doubt... Just curious as to why Microsoft has made 2 functions available in VBA, with same name but with different results. VBA trim is concerned only with leading spaces, while App.Wkshfunction.trim removes all spaces (except a single space between words). If the end results are different then, shouldnt the name of the functions be different. -- Thanks a lot, Hari India |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trim | Excel Discussion (Misc queries) | |||
Trim | Excel Worksheet Functions | |||
Application.Trim with VBA | Excel Discussion (Misc queries) | |||
TRIM? | Excel Worksheet Functions | |||
Trim like worksheet Trim | Excel Programming |