View Single Post
  #6   Report Post  
Posted to microsoft.public.excel.programming
Project Mangler Project Mangler is offline
external usenet poster
 
Posts: 63
Default Application or object defined error

Raj,

I can't duplicate your error here, the code works OK if I try to detect a
haracter other than "'" .

I'm wondering how you are going to detect a single quote at the start of a
string? e.g.

If Left(Cells(i, 4), 1) = "'" Then
MsgBox "Apostrophe!"
Else
MsgBox "No Apostrophe!"
End If

The above line copied from your post gives me No Apostrophe.

In a cell containing the string 'Length I get a Len() of 6.

DB

"Raj" wrote in message
...
Hi,

When I run the following code, I am getting the Application or object
defined error. The second line is a single line in my code. The VBE
highlights the portion after "Then" in the second line.

Sub Cleancolumn1()
For i = 1 To ThisWorkbook.Worksheets("Sheet1").Cells(Rows.Count ,
14).End(xlUp).Row
If Left(Cells(i, 14), 1) = "'" Then
ThisWorkbook.Worksheets("Sheet1").Cells(i, 14) = Right(Cells(i, 14),
Len(Cells(i, 14)) - 1)
Next i
End Sub

What is going wrong?

Thanks in advance for the help.

Regards,
Raj