View Single Post
 
Old September 18th, 2009, 09:02 AM
JP JP is offline
Authorized User
Points: 199, Level: 3
Points: 199, Level: 3 Points: 199, Level: 3 Points: 199, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Apr 2008
Location: NYC, NY, USA.
Posts: 57
Thanks: 1
Thanked 3 Times in 3 Posts
Default

Try this:

Code:
 
Sub RemoveBrackets()
Dim arrData() As Variant
Dim arrReturnData() As Variant
Dim rng As Excel.Range
Dim lRows As Long
Dim lCols As Long
Dim i As Long, j As Long
  lRows = Selection.Rows.Count
  lCols = Selection.Columns.Count
  ReDim arrData(1 To lRows, 1 To lCols)
  ReDim arrReturnData(1 To lRows, 1 To lCols)
  Set rng = Selection
  arrData = rng.Value
  For j = 1 To lCols
    For i = 1 To lRows
      If Left$(arrData(i, j), 1) = "[" And _
         Right$(arrData(i, j), 1) = "]" Then
        arrReturnData(i, j) = Mid$(arrData(i, j), 2, Len(arrData(i, j)) - 2)
      Else
        arrReturnData(i, j) = arrData(i, j)
      End If
    Next i
  Next j
  rng.Value = arrReturnData
End Sub
--JP


Quote:
Originally Posted by DoriftuEvo View Post
2.00657892
3.10558234
[10.2345342]
[14.2560234]
4.13423105
5.14613461
4.23123451


2.23453253
[12.3452352]
[15.1624525]
[14.2145324]


Here's an example of what the column looks like. I left blank rows on purpose because some cells are blank.

Thanks for the quick response.