LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 30
Default remove text between [ ]

On 04/07/2010 13:26, Don Guillett Excel MVP wrote:
On Jul 4, 7:15 am, Don Guillett Excel
wrote:
On Jul 4, 5:07 am, wrote:





Hi


I wanted to remove the brackets and text within them using vba. In
each cell I have the item;


There [has to be an answer] it is.


Where the result after running the process is ;


There it is.


I have been searching for hours and can't seem to find anything that
specifically gets this done.


Any help or pointers greatly appreciated.


Chad


=LEFT(C16,FIND("[",C16)-1)& RIGHT(C16,LEN(C16)-FIND("]",C16)-1)- Hide quoted text -

- Show quoted text -

You did say VBA

Option Explicit
Sub clearmidtextSAS()
Dim c As Range
Dim p1 As Double
Dim p2 As Double
For Each c In Range("c16:c16") 'With ActiveCell
p1 = InStr(c, "[")
'MsgBox p1
p2 = InStr(c, "]")
'MsgBox p2
c.Value = Left(c, p1 - 1)& Right(c, Len(c) - p2 - 1)
Next c
End Sub


Don,

Out of curiosity why are p1 7 p2 dimmed as double rather than long?


 
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
Text - Remove text Item No.99 (First 2 Chars) and move to end dplunkett Excel Discussion (Misc queries) 5 June 16th 09 04:26 PM
Easiest way to remove text from a cell that has text and numbers? [email protected] Excel Discussion (Misc queries) 2 August 17th 06 06:07 PM
Filter text in a column by its Indent, to remove certain text 99TZ250 Excel Discussion (Misc queries) 1 May 21st 06 08:53 AM
want to remove all text characters equal to one character in length from text string [email protected] Excel Worksheet Functions 1 April 18th 05 09:56 PM
want to remove all text characters equal to one character in length from text string [email protected] Excel Worksheet Functions 1 April 18th 05 12:25 AM


All times are GMT +1. The time now is 03:44 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"