View Single Post
  #10   Report Post  
Posted to microsoft.public.excel.programming
Bob Kilmer Bob Kilmer is offline
external usenet poster
 
Posts: 280
Default extraction VB code

This is a suggested substitution for Dave Shapiro to employ to record the
error number and description or an error when it occurs and to hint at error
handling. As written, it will also "swallow" the error, quitely writing it
out, but not interupting exectution, so it needs be modified to re-raise an
error or only used while debugging if that is a problem.

Of course stepping thu the code when it breaks and making a note of the
exact error message when it comes up are wise and ultimately simpler
alternatives.

Bob

"Myrna Larson" wrote in message
...
What's the error number and description, and on what line does it occur?

Have
you stepped through the code with F8?

On Fri, 17 Sep 2004 22:57:14 -0400, "Bob Kilmer"

wrote:

Sub cleanworksheet()
'For some reason, an error comes up here
'' What error?
On Error GoTo ErrHandler

Dim c As Range
For Each c In ActiveSheet.UsedRange.Cells
c.Value = WorksheetFunction.Clean(c.Text)
Next

Exit Sub
ErrHandler:
Debug.Print "Error #: " & Err.Number & vbNewLine; "Description: " &
Err.Description

End Sub

"david shapiro" wrote in message
...
I've put together this code to extract and id code data from an excel
workbook, but have come across quite a few bugs. I've tried to put
comments in the VB code describing what's going on at each stage. I
would appreciate it if someone could clear up the errors and get it
running. Thanks.

Dave Shapiro

<balance of message deleted for brevity. See original post.