trimming cells

  • Thread starter Thread starter Tejas Kokje
  • Start date Start date
T

Tejas Kokje

I am trying to trim the "N0001271226 " which is in cell(1,2)which has
extra space at end (string that remains after discarding quotes)

I am using Sheet1.Cells(1,4).value = Trim(Sheet1.Cells(1,2).Value) to
copy trimmed string into Sheet1.Cells(1,4). Yet the new string is not
trimmed.

Any suggetions. I am a novice vba programmer and hence I might have
missed few important points.

Regards,
Tejas Kokje
 
I tried the following in the intermidate window and it
worked.

If A1 contained "N0001271226 ", it worked.

?Trim(sheet2.Cells(1,1).value) & "*"
N0001271226*
N0001271226*
N0001271226 *
N0001271226

Mr. Tucker
California
 
An occasional problem is that what looks like a space is not a space!
One culprit is CHAR(160), which, if I remember correctly, is a 'non
breaking space.'

--
Regards,

Tushar Mehta
www.tushar-mehta.com
Excel, PowerPoint, and VBA add-ins, tutorials
Custom MS Office productivity solutions
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Cdbl and Cstr with a "Type Mismatch" Error 6
trim 2
trim not working 2
VBA Type mismatch error 1
Trim function in macro 2
Access VBA to format Excel 1
trim, chr(10) 24
Reference for Trim$ ??? 8

Back
Top