View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
ozgrid.com ozgrid.com is offline
external usenet poster
 
Posts: 464
Default Application or object defined error

Do you have a "Sheet1" tab name in "Thisworkbook"?



--
Regards
Dave Hawley
www.ozgrid.com
"Raj" wrote in message
...
Yes. But the error again occurred again. This time the line above the
End If was highlighted in yellow with the same error code displayed.

Regards,
Raj




On Mar 26, 11:35 am, "ozgrid.com" wrote:
Hi Raj

Do you mean?

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

--
Regards
Dave Hawleywww.ozgrid.com"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