Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 19
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,302
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 14
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Trimming text from the end of cell contents. Colin Hayes Excel Worksheet Functions 8 September 1st 09 01:07 AM
Trimming/Truncating Text Field in Excel billbrandi Excel Discussion (Misc queries) 3 August 3rd 08 05:29 AM
Trimming text scott Excel Worksheet Functions 4 December 16th 06 04:49 PM
Grid column display text trimming ExcellUser Excel Discussion (Misc queries) 0 December 13th 05 05:21 PM
trimming blank cells St. Matthew Excel Worksheet Functions 3 April 29th 05 03:20 AM


All times are GMT +1. The time now is 05:40 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"