ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   LTrim (https://www.excelbanter.com/excel-programming/271988-ltrim.html)

Dave B[_3_]

LTrim
 
I'm getting an error for the following code:

Dim strText1 As String, strText2 As String
....
strText2 = LTRIM(strText1)

The error is "Wrong number of arguments or invalid property assignment"

The code looks exactly like the example in the help file. Anyone know why
am I getting this error?




patrick molloy

LTrim
 
Looks fine to me...in a standard module:
Sub Test1()
MsgBox MyTrim(" A B C ")
End Sub
Function MyTrim(strText1 As String) As String
Dim strText2 As String
strText2 = LTrim(strText1)
MyTrim = strText2
End Function

I used a function so that it could be called from a sub
as in the test above, or from a worksheet cell.

Patrick Molloy
Microsoft Excel MVP


-----Original Message-----
I'm getting an error for the following code:

Dim strText1 As String, strText2 As String
....
strText2 = LTRIM(strText1)

The error is "Wrong number of arguments or invalid

property assignment"

The code looks exactly like the example in the help

file. Anyone know why
am I getting this error?



.



All times are GMT +1. The time now is 11:46 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com