Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trimming text contained in cells
Is this even possible?
I have a list of sizes contained in cells in Column C. Column C 4 x 32 x 1 16 x 32 x 1.25 14.375 x 23 x 1.25 6.5 x 52 x 1.25 4.5 x 23 x 1.25 2.5 x 23 x 1.25 What I need to do is look at each populated cell in Column C and remove the first number, the space following the first number, the "x", and the space following the "x" so I will end up with this: Column C 32 x 1 32 x 1.25 23 x 1.25 52 x 1.25 23 x 1.25 23 x 1.25 This one is WAY beyond me, any help would be appreciated. |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trimming text contained in cells
Hi Todd,
Try: Sub Tester() Dim Rng As Range, cell As Range Dim pos As Long Set Rng = ActiveSheet.Range("C2:C100") '<=== CHANGE! For Each cell In Rng pos = InStr(1, cell.Value, "x") cell.Value = Right(cell.Value, Len(cell.Value) - pos) Next End Sub Change the range address to your needs. --- Regards, Norman "ToddG" wrote in message ... Is this even possible? I have a list of sizes contained in cells in Column C. Column C 4 x 32 x 1 16 x 32 x 1.25 14.375 x 23 x 1.25 6.5 x 52 x 1.25 4.5 x 23 x 1.25 2.5 x 23 x 1.25 What I need to do is look at each populated cell in Column C and remove the first number, the space following the first number, the "x", and the space following the "x" so I will end up with this: Column C 32 x 1 32 x 1.25 23 x 1.25 52 x 1.25 23 x 1.25 23 x 1.25 This one is WAY beyond me, any help would be appreciated. |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Trimming text contained in cells
Hi,
Try: Dim RNG As Range Dim CL As Range Dim N As Long Set RNG = ActiveSheet.Range("C2:C100") For Each CL In RNG If UCase(CL) Like "*X*X*" Then N = InStr(1, UCase(CL), "X", vbTextCompare) CL.Value = Trim(Mid(CL, N + 1, Len(CL))) End If Next -- Regards, Soo Cheon Jheong Seoul, Korea _ _ ^ąŻ^ -- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Trimming text from the end of cell contents. | Excel Worksheet Functions | |||
Trimming/Truncating Text Field in Excel | Excel Discussion (Misc queries) | |||
Trimming text | Excel Worksheet Functions | |||
Grid column display text trimming | Excel Discussion (Misc queries) | |||
trimming blank cells | Excel Worksheet Functions |