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.
 

Some videos you may like

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.

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

ADVERTISEMENT

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.
 

Watch MrExcel Video

Forum statistics

Threads
1,122,232
Messages
5,594,962
Members
413,954
Latest member
mrsandy

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top