Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Marco - I need to trim/move the text from the beginning of each ce

I need to cut everything up to and including "v." from each row. The first
row below should read "County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21,
2007)"

Toussie v. County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21, 2007)
TPS, Inc. v. United States Dept. of Defense, 330 F.3d 1191 (9th Cir. 2003)
Tracy v. Fin. Ins. Mgmt. Corp., 2005 WL 2100261 (S.D. Ind. Aug. 22, 2005)
Trammell v. Anderson Coll., 2006 WL 1997425 (D.S.C. July 17, 2006)

Any help?
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 10,124
Default Marco - I need to trim/move the text from the beginning of each ce

Sub parsestring1()
On Error Resume Next
For Each c In Range("d3:d7")

x = InStr(c, "v") + 2
c.Offset(, 1) = Right(c, Len(c) - x)
'above for testing if OK delete and uncomment below line
'c.value = Right(c, Len(c) - x)

Next c
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software

"suestew" wrote in message
...
I need to cut everything up to and including "v." from each row. The first
row below should read "County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec.
21,
2007)"

Toussie v. County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21, 2007)
TPS, Inc. v. United States Dept. of Defense, 330 F.3d 1191 (9th Cir. 2003)
Tracy v. Fin. Ins. Mgmt. Corp., 2005 WL 2100261 (S.D. Ind. Aug. 22, 2005)
Trammell v. Anderson Coll., 2006 WL 1997425 (D.S.C. July 17, 2006)

Any help?


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Marco - I need to trim/move the text from the beginning of each ce

You didn't say which column the data is in. This macro assumes it is in
column A.
You can modify accordingly.

Sub getCase()
Dim x As Long, s As Long, c As Range
For Each c In Range("A" & Cells(Rows.Count, 1).End(xlUp).Row)
If InStr(c.Value, "v") 0 Then
x = InStr(Range("A2"), "v") + 2
s = Right(Range("A2"), Len(Range("A2").Value) - x)
MsgBox s 'For test only, substitute cells posting code
End If
Next
End Sub






"suestew" wrote:

I need to cut everything up to and including "v." from each row. The first
row below should read "County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21,
2007)"

Toussie v. County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21, 2007)
TPS, Inc. v. United States Dept. of Defense, 330 F.3d 1191 (9th Cir. 2003)
Tracy v. Fin. Ins. Mgmt. Corp., 2005 WL 2100261 (S.D. Ind. Aug. 22, 2005)
Trammell v. Anderson Coll., 2006 WL 1997425 (D.S.C. July 17, 2006)

Any help?

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,986
Default Marco - I need to trim/move the text from the beginning of eac

Just realized I left test syntax in the code.
This will work better.

Sub getCase()
For Each c In Range("A" & Cells(Rows.Count, 1).End(xlUp).Row)
If InStr(c.Value, "v") 0 Then
x = InStr(c.Value, "v") + 2
s = Right(c.Value, Len(Range("A2").Value) - x)
MsgBox s
End If
Next
End Sub

If any of the lines do not have a space after v. then it will clip the first
letter of the next word off. Be sure to edit for that.

"JLGWhiz" wrote:

You didn't say which column the data is in. This macro assumes it is in
column A.
You can modify accordingly.

Sub getCase()
Dim x As Long, s As Long, c As Range
For Each c In Range("A" & Cells(Rows.Count, 1).End(xlUp).Row)
If InStr(c.Value, "v") 0 Then
x = InStr(Range("A2"), "v") + 2
s = Right(Range("A2"), Len(Range("A2").Value) - x)
MsgBox s 'For test only, substitute cells posting code
End If
Next
End Sub






"suestew" wrote:

I need to cut everything up to and including "v." from each row. The first
row below should read "County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21,
2007)"

Toussie v. County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21, 2007)
TPS, Inc. v. United States Dept. of Defense, 330 F.3d 1191 (9th Cir. 2003)
Tracy v. Fin. Ins. Mgmt. Corp., 2005 WL 2100261 (S.D. Ind. Aug. 22, 2005)
Trammell v. Anderson Coll., 2006 WL 1997425 (D.S.C. July 17, 2006)

Any help?

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Marco - I need to trim/move the text from the beginning of each ce

On Sun, 5 Oct 2008 13:05:14 -0500, "Don Guillett"
wrote:

Sub parsestring1()
On Error Resume Next
For Each c In Range("d3:d7")

x = InStr(c, "v") + 2
c.Offset(, 1) = Right(c, Len(c) - x)
'above for testing if OK delete and uncomment below line
'c.value = Right(c, Len(c) - x)

Next c
End Sub

--
Don Guillett
Microsoft MVP Excel
SalesAid Software


This doesn't work if there is a "v" in the first name. e.g:

Travelers Ins v. Valerie Cohn, 2006 WL 1997425 (D.S.C. July 17, 2006)

--ron


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Marco - I need to trim/move the text from the beginning of each ce

On Sun, 5 Oct 2008 09:36:00 -0700, suestew
wrote:

I need to cut everything up to and including "v." from each row. The first
row below should read "County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21,
2007)"

Toussie v. County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21, 2007)
TPS, Inc. v. United States Dept. of Defense, 330 F.3d 1191 (9th Cir. 2003)
Tracy v. Fin. Ins. Mgmt. Corp., 2005 WL 2100261 (S.D. Ind. Aug. 22, 2005)
Trammell v. Anderson Coll., 2006 WL 1997425 (D.S.C. July 17, 2006)

Any help?


The macro below will place everything after the "v. " in the cell to the right
of "Selection".

============================================
Sub Defendant()
Dim c As Range
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = "^.*\bv\.\s+"

For Each c In Selection
If re.test(c.Value) = False Then
c.Offset(0, 1) = "no ""v. "" in string"
Else
c.Offset(0, 1).Value = re.Replace(c.Value, "")
End If
Next c
End Sub
================================================
--ron
  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,651
Default Marco - I need to trim/move the text from the beginning of each ce

On Sun, 5 Oct 2008 15:44:06 -0500, "Don Guillett"
wrote:

Good catch. But it does if you just add a dot after the v
v.

--
Don Guillett
Microsoft MVP Excel
SalesAid Software


Of course <sound of hand slapping side of head.

I didn't look at the code closely, just the results.

It might be more robust, though, if you looked for
<spacev.<space

Probably should be case sensitive also to avoid splitting on a name that
includes a V. (V.S. INT'L is a company name).
--ron
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 29
Default Marco - I need to trim/move the text from the beginning of eac

I'm working in a Mac. None of the macros are working. ??? Or maybe I not
doing something correctly on my end. I'll go try these on a PC but should
there be a problem?

"Ron Rosenfeld" wrote:

On Sun, 5 Oct 2008 09:36:00 -0700, suestew
wrote:

I need to cut everything up to and including "v." from each row. The first
row below should read "County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21,
2007)"

Toussie v. County of Suffolk, 2007 WL 4565160 (E.D.N.Y. Dec. 21, 2007)
TPS, Inc. v. United States Dept. of Defense, 330 F.3d 1191 (9th Cir. 2003)
Tracy v. Fin. Ins. Mgmt. Corp., 2005 WL 2100261 (S.D. Ind. Aug. 22, 2005)
Trammell v. Anderson Coll., 2006 WL 1997425 (D.S.C. July 17, 2006)

Any help?


The macro below will place everything after the "v. " in the cell to the right
of "Selection".

============================================
Sub Defendant()
Dim c As Range
Dim re As Object
Set re = CreateObject("vbscript.regexp")
re.Global = True
re.Pattern = "^.*\bv\.\s+"

For Each c In Selection
If re.test(c.Value) = False Then
c.Offset(0, 1) = "no ""v. "" in string"
Else
c.Offset(0, 1).Value = re.Replace(c.Value, "")
End If
Next c
End Sub
================================================
--ron

  #10   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Marco - I need to trim/move the text from the beginning of eac


Well that was a little confusing, but I think this might do what you
want.

Code:
--------------------
Sub getCase()
Dim c As Excel.Range
Dim x As Long
Dim s() As String
For Each c In Range("A1:A" & Cells(Rows.Count, 1).End(xlUp).Row)
s = Split(c.Value, " v. ")
c.Value = s(0)
c.Offset(0, 1).Value = s(1)
Next
End Sub
--------------------


--
Oorang
------------------------------------------------------------------------
Oorang's Profile: http://www.thecodecage.com/forumz/member.php?userid=129
View this thread: http://www.thecodecage.com/forumz/showthread.php?t=88

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
Move/reset to the beginning of a TextStream Conan Kelly Excel Programming 1 August 23rd 08 01:08 AM
Need to move - from end of number to beginning Giggly4g Excel Discussion (Misc queries) 6 April 2nd 08 05:28 AM
shortcut key to move to beginning of new row bob engler Excel Worksheet Functions 2 April 23rd 06 08:01 PM
need enter key to move to the next column beginning j pantozzi Excel Worksheet Functions 2 December 5th 05 04:57 PM
Shortcut key to move to beginning of a worksheet Martha Excel Discussion (Misc queries) 1 February 22nd 05 07:53 PM


All times are GMT +1. The time now is 02:00 PM.

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

About Us

"It's about Microsoft Excel"