Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim the last two characters?
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 |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim the last two characters?
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. -- Regards, Tom Ogilvy "Craig" wrote in message ... 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 |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim the last two characters?
|
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim the last two characters?
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 -----Original Message----- have you tried left(ref,len(ref)-2)? --- Message posted from http://www.ExcelForum.com/ . |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trim the last two characters?
I gave you an example with cells.value?
what what the problem with it? -- Regards, Tom Ogilvy "Craig" wrote in message ... 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 -----Original Message----- have you tried left(ref,len(ref)-2)? --- Message posted from http://www.ExcelForum.com/ . |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trim out last seven characters from a string... | Excel Discussion (Misc queries) | |||
Trim characters | Excel Worksheet Functions | |||
Trim hidden characters? | Excel Worksheet Functions | |||
How do you trim characters? | Excel Worksheet Functions | |||
Trim characters | Excel Programming |