Home |
Search |
Today's Posts |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Just caused an error for me since str is looking for a number argument to
convert to a string changing it to cstr fixed it. But you don't need any conversion at all since it is a string already Sub testTrim() Sheet3.Range("B2").Value = Trim(CStr("hhh" & Chr(10))) End Sub Sub testTrim() Sheet3.Range("B2").Value = Trim("hhh" & Chr(10)) End Sub -- Regards, Tom Ogilvy "KR" wrote in message ... I wanted to test to see if the Trim function would also take off any extra chr(10)'s because I'm concatenating strings within cells and have to line up my information with adjacent cells- but I sometimes end up with an extra chr(10) at either the beginning or end of the cell, and I was looking for an easy way to remove it. I wrote the following to test to see if Trim would work (or if it only works on regular extra spaces). The first several times I got an 'out of memory' error, so I rebooted, and from a clean boot, tried again, and it ended up taking over by hogging loads of memory -at least I don't have any other explanation, since nothing else was running on the PC, and when I hard exited Excel via the task manager my memory opened back up. So, here's my question- why would this one line of code cause Excel to "freak out"? Or do I have something else going on that I'm mis-attributing to Excel? XL2003 on Win2000. Test at your own risk :\ Sub testTrim() Sheet4.Range("B2").Value = Trim(Str("hhh" & Chr(10))) End Sub -- The enclosed questions or comments are entirely mine and don't represent the thoughts, views, or policy of my employer. Any errors or omissions are my own. |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro code to put series name next to individual line in line grap | Charts and Charting in Excel | |||
Trim with Country code leading | Excel Worksheet Functions | |||
Code for Trim function | Excel Discussion (Misc queries) | |||
Trim function doesn't clean out ASCII Code 160 (Space) | Excel Worksheet Functions | |||
VBA Trim and Application.worksheetfunction.Trim | Excel Programming |