Microsoft Office Forums

Go Back   Microsoft Office Forums > >

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
  #10  
Old 03-25-2018, 05:38 PM
kevinbradley57 kevinbradley57 is offline Find and remove right parenthesis and preceding 11 characters Windows 7 64bit Find and remove right parenthesis and preceding 11 characters Office 2010 64bit
Advanced Beginner
Find and remove right parenthesis and preceding 11 characters
 
Join Date: Jul 2017
Posts: 89
kevinbradley57 is on a distinguished road
Default

NoSparks -- Your code does exactly what I needed, but the "arr(2)" portion it appears to limit the number of names in the cell to two. There could be as many as 10 names in the cell, or as few as none. Can you help with that?

Sub RemoveParenth_2()

Dim rng As Range, cel As Range
Dim lr As Long, arr As Variant

lr = Cells.Find(What:="*", SearchDirection:=xlPrevious, SearchOrder:=xlByRows).Row
Set rng = Union(Range("A1:A" & lr), Range("B1:B" & lr), Range("J1:J" & lr))

For Each cel In rng
If InStr(1, cel.Value, "(") > 0 And InStr(1, cel.Value, ")") > 0 Then
arr = Split(Replace(Replace(cel.Value, "(", "|"), ")", "|"), "|")
cel.Value = Trim(arr(0) & arr(2))
End If
Next cel
End Sub
Reply With Quote
 



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to remove first 12 characters of each cell King Mustard Excel 3 04-07-2017 12:06 AM
Can I remove spaces between only Chinese characters? sivartnosredna7 Word 2 01-09-2017 05:33 AM
Find and remove right parenthesis and preceding 11 characters How do I Remove A Specific Amount of Characters from Lines in a Document? tatihulot Word 5 01-22-2016 05:55 AM
Find and Replace Parenthesis with Itallics Richard Carr Word 1 01-06-2015 06:44 PM
How to remove these unknown characters appearing rajpes Word 1 03-02-2012 03:24 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 10:28 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft