Trim the last two characters?

  • Thread starter Thread starter Craig
  • Start date Start date
C

Craig

Hi folks,
I'm new to VBA, but I've programmed in VB (a little bit)
before. I have several cells that I simply need to trim
off the last 2 characters from. Is there a function in
Excel that can do that?...or does someone know of a
function that will do that? I frequently have something
like: 373.62CR and I need to keep the numeric portion, but
lose the text portion. Suggestions???

Thanks,
Craig
 
Is the CR produced by formatting or is this actually part of the value of
the cell. If you select the cell is it shown in the formula bar?

Assuming it is part of the text in the cell

Sub Remove2()
for each cell in selection
if not cell.Hasformula then
cell.Value = Left(cell.value,len(Cell.Value)-2)
end if
Next
End Sub

Assume the value is in A1, in B1 =Left(A1,len(A1)-2)

then drag fill down the column.
 
Hi Duane,
No, I haven't. Can you give me an example using the
Cells.Value concept (I don't quite understand the syntax
you've suggested), which is how I would be using it?

Thank you!
Craig
 
I gave you an example with cells.value?
what what the problem with it?
 

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

trim not working 2
Trim leading numbers 5
Add - Trim(Clean()) 3
trim, chr(10) 24
Need macro to trim characters in column 5
triming the first 10 characters in a cell.. 2
Reference for Trim$ ??? 8
Access Access anti-trim?? 0

Back
Top