Need Help - Small fix required

arjunmca

New Member
Joined
Oct 1, 2008
Messages
17
Hi,
I wrote the below code to clear 'B5' cell value.

Worksheets("Sheet1").Range("B5")=""

Its working fine in Win 2000. But in Excel 2007 it is giving the following error on VISTA OS.

Run-time error '-2147417848 (80010108)':
Method 'Value' of object 'Range' failed

Can any body fix that error.
-Arjun.
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Why not?
Code:
[B5].ClearContents or
Range("B5").ClearContents
lenze
 

arjunmca

New Member
Joined
Oct 1, 2008
Messages
17
Hi,

Thanks for your reply.

(1) Worksheets("Sheet1").Range("B5").value=""

Still the same error coming.

(2). Worksheets("Sheet1").Range("B5").clearcontents

Cell is not clearing the contents. The value remains in the B5 cell.
Do we need to use screen updation.
I even tried with Application.ScreenUpdating=True.

But it is not clearing the cell.

Please try to fix this error.
 

lenze

Legend
Joined
Feb 18, 2002
Messages
13,690
Don't know what's happening, but
Code:
Sub Fanugi()
Sheets("Sheet1").Range("$B$5").ClearContents
End Sub
works, as does
Code:
Sub Fanugi2()
[B5].ClearContents
End Sub
lenze
 

arjunmca

New Member
Joined
Oct 1, 2008
Messages
17
Hi,

I tried as you replied. But still getting the same error in 2007 office in Vista OS.

Sheets("Sheet1").Range("$B$5").ClearContents
[B5].ClearContents


Can you please confirm that after the testing the code in 2007 office in Vista system.

Regards,
Arjun.
 

Forum statistics

Threads
1,085,335
Messages
5,383,032
Members
401,812
Latest member
topherj09

Some videos you may like

This Week's Hot Topics

Top