Deleting

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I have some extra spaces that pop up when copying data from a webpage.

Example:

123,123 comes into Excel as
123,123 with a space at the beginning and the end.

I am doing some calculations with these cells in a macro, and of course the
formula won't calculate until i delete the space at the beginning and the
end. What would be a good way to get rid of those spaces? There are many
cells, so a nice formula would be great, I can slip it into the macro and go
about my merry way.

Text to columns isn't seeming to work, The length of the data in the cells
varies from 2 numbers to a 8 numbers. Any advice will be useful, THANKS!!!
 
I have some extra spaces that pop up when copying data from a webpage.

Example:

123,123 comes into Excel as
123,123 with a space at the beginning and the end.

I am doing some calculations with these cells in a macro, and of course the
formula won't calculate until i delete the space at the beginning and the
end. What would be a good way to get rid of those spaces? There are many
cells, so a nice formula would be great, I can slip it into the macro and go
about my merry way.

Text to columns isn't seeming to work, The length of the data in the cells
varies from 2 numbers to a 8 numbers. Any advice will be useful, THANKS!!!

try
=TRIM(text)
 
I'm not sure I'm getting how to utilize that in a macro. With the cell
selected do: ???

Thanks for the help!
 
Dim MyString, TrimString
MyString = ActiveCell
TrimString = Trim(MyString)

This is what i'm trying, and it's just not working. Doesn't seem to come up
with any errors, just does nothing.
 
Back
Top