Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Clean Me" Macro is giving "#VALUE!" error in the Notes field.

I have exported my .PST file from Outlook as a .csv file and then I need to
clean up all the extra characters. I have a code for "Clean Me."
It is:
Sub CleanMe()
Dim cel As Range
Application.ScreenUpdating = False
For Each cel In ActiveSheet.UsedRange
cel = Application.Clean(cel) (Use the tab key to indent this line of the
code.)
Next cel
Application.ScreenUpdating = True
End Sub
But after i run it, it gives a "#VALUE!" error in some of the fields. All of
the fields that get messed up are the fields from the "Notes section" in
outlook. All of the notes fields don't mess up, but a lot do.

Please Help!

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default "Clean Me" Macro is giving "#VALUE!" error in the Notes field.

Ryan,

The clean function is probably leaving a cell that Excel
thinks is an invalid formula.
The following mod takes care of most of that.

'--------------------------------
Sub CleanMe()
Dim cel As Excel.Range
Application.ScreenUpdating = False
For Each cel In ActiveSheet.UsedRange
On Error Resume Next
cel.Value = Application.Clean(cel.Value)
If Err.Number < 0 Then
'use a single apostrophe
cel.Value = "'" & Application.Clean(cel.Value)
Err.Clear
End If
Next cel
Application.ScreenUpdating = True
End Sub
'-------------------------------

Regards,
Jim Cone
San Francisco, USA


"Ryan Watkins" <Ryan wrote in
message ...
I have exported my .PST file from Outlook as a .csv file and then I need to
clean up all the extra characters. I have a code for "Clean Me."
It is:
Sub CleanMe()
Dim cel As Range
Application.ScreenUpdating = False
For Each cel In ActiveSheet.UsedRange
cel = Application.Clean(cel) (Use the tab key to indent this line of the
code.)
Next cel
Application.ScreenUpdating = True
End Sub
But after i run it, it gives a "#VALUE!" error in some of the fields. All of
the fields that get messed up are the fields from the "Notes section" in
outlook. All of the notes fields don't mess up, but a lot do.

Please Help!

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel - Golf - how to display "-2" as "2 Under" or "4"as "+4" or "4 Over" in a calculation cell Steve Kay Excel Discussion (Misc queries) 2 August 8th 08 01:54 AM
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" ldiaz Excel Discussion (Misc queries) 2 March 16th 08 09:23 PM
Run macro only if Field E10 = "WO ID" and AB10 = "Spec Sizing" ldiaz Excel Discussion (Misc queries) 2 March 15th 08 07:26 PM
change "true" and "false" to "availble" and "out of stock" inthestands Excel Worksheet Functions 2 July 19th 07 07:05 PM
Utility to "clean up" or "defrag" large Excel file Sabrina Excel Discussion (Misc queries) 3 January 12th 06 09:57 PM


All times are GMT +1. The time now is 09:58 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"