jibinpt
asked on
Replace function while using EXCELVBA
Hi,
I am trying to use a replace function to replace a field's "," character with spaces. It gives me a compilation error saying Replace function not defined. is there any specific reference that I need to add for using replace functions?. I am using TRIM without any trouble. Can someone suggest any better alternative
Thanks
I am trying to use a replace function to replace a field's "," character with spaces. It gives me a compilation error saying Replace function not defined. is there any specific reference that I need to add for using replace functions?. I am using TRIM without any trouble. Can someone suggest any better alternative
Thanks
try this out:
ThisWorkbook.Worksheets(1) .Range("A1 :J10").Rep lace ",", " ", xlPart, xlByRows
hope that helps!
-PtG
ThisWorkbook.Worksheets(1)
hope that helps!
-PtG
ASKER
This is my code
ReplacedDesc = Replace(lsProcessSheet.Cel ls(lrow, glDescCol), ",", " ").. VBA.Replace is not working
ReplacedDesc = Replace(lsProcessSheet.Cel
When you type in VBA and then hit the dot (.) does the list of available function calls come up? Is Replace listed as one of them?
You need to add .Value
ReplacedDesc = Replace(lsProcessSheet.Cel ls(lrow, glDescCol).Value, ",", " ")
HTH
dragontooth
ReplacedDesc = Replace(lsProcessSheet.Cel
HTH
dragontooth
ASKER
When I type in VBA the dot (.) does come up but Replace is not one among them. RESET is the only one which comes up with RE.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Oh, is this VBA 97? Replace didnt come around until VB6, so I guess that would mean VBA 2000?
Are you getting an error on the replace line or is it just not working?
dragontooth
dragontooth
thanks for the points and the A! time to go home now... happy programming, people!
Regards,
PtG
Regards,
PtG
VBA.Replace(...)