View Single Post
Old September 20th, 2009, 11:38 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 Making it easier yet...

Next we get to look at: How did the numbers get there in the first place?
Look at the process you used to write those values.
Was it in a script? I'd suggest adding something like this into your script:

Assuming your script is working with some value numberWorkingWith from somewhere. Sometimes it picks up a number with brackets, sometimes not.
Assume that you're incrementing nextRow after each write, and you have a fixed column numberColumn.
The idea is to strip the brackets before writing them to the column. That way you never have to go run a macro or a sub - the numbers will automagically be the way you want them - you only have to do this ONCE, in the feed script, not every time you repeat the process of writing this set of values to the column.

nValueToWrite = replace(numberWorkingWith, "]", "")
nValueToWrite = replace(numberWorkingWith, "[", "")
cell(nextRow, numberColumn) = nValueToWrite

Originally Posted by Shasur View Post
Just in case if you are not worried about the position of the brackets (first, last etc), you might find the following faster:

Range("A1:A100").Replace "[", ""
Range("A1:A100").Replace "]", ""