View Single Post
 
Old September 20th, 2009, 05:34 AM
gluefish gluefish is offline
Registered User
 
Join Date: Sep 2009
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to gluefish
Default Getting rid of the brackets.

You want to get rid of the brackets.

You could use the instructions stanleydgromjr (above) used to install a macro.
Personally, I don't bother with the macros, just put a sub in the code page using alt-F11, to access it. To run it, place the cursor in the code and hit F5.

Everyone else but me seems to think it was necessary to just take the brackets from the left and right side of your numbers. Looking at it, it appeared you just wanted plain numbers, and the place of the brackets didn't matter.

Also, I think setting the range unnecessarily complicates matters when you can just make a loop that uses cell references.

Try this: assuming your data is from A1 to A100:

Code:
Sub removeBrackets()
    Dim r
    For r = 1 To 100
        Cells(r, 1) = Replace(Cells(r, 1), "[", "")
        Cells(r, 1) = Replace(Cells(r, 1), "]", "")
    Next
End Sub
(That left me with:)
2.00657892
3.10558234
10.2345342
14.2560234
4.13423105
5.14613461
4.23123451

2.23453253
12.3452352
15.1624525
14.2145324


Quote:
Originally Posted by DoriftuEvo View Post
I'm trying to remove a [ and ] from the beginning and end of some cell values in a specific column. I want to check each cell to see if it contains those characters and remove them if it does.

Thanks for the help!

Last edited by gluefish; September 20th, 2009 at 05:44 AM..