Thread: The @ symbol
View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default The @ symbol

I'm reading this as the import of the data works fine--but subsequently, you
make a change to cells that start with that @ symbol.

And then all heck breaks lose.

Excel does change that leading @ to an equal sign -- even if the cell was
formatted to text before the change. Then it burps if the resulting change
would not have been a valid function.

This seemed to work ok for me:
Select the range to change
edit|replace
what: @
with: '@ (apostrophe @)
replace all

The cells that begin with @ will still look nice in the cell -- but you'll see
the leading apostrophe in the formula bar. The cells that have @ somewhere in
the middle will now look like asdf'@qwer (with that newly embedded apostrophe).

Then do your real edit|replaces. That leading apostrophe will keep the cell
text even after the change.

Then clean up your mess.

Selec the range again (if you have to)
edit|replace
what: '@
with: @
replace all

Excel won't touch that prefixcharacter, but will remove the embedded
apostrophe's. (This can often be a curse. But for you it's a nice feature.)

If you're using a macro, you could include the two extra edit|replaces in your
code, too.

GeraldM wrote:

I am importing text into a range of cells then processing it using a VBA
macro to replace particular characters.

However if the imported text starts with the @ character the replacement
routine does not process that cell or subsequent cells.

In this instance, because I control the exported data, I have simply added a
"Space" character before the @ symbol prior to exporting.

However this may not always be an option.

Does anyone have any suggestions on how to force the replace function to
treat the @ symbol as a normal character?

Regards GeraldM


--

Dave Peterson