Clear Range on Hidden Sheet

DanGK1

Board Regular
Joined
Jul 7, 2010
Messages
52
Hello

I cannot work out why I cannot clear a range on a hidden sheet.

I have tried the following, but neither work unless I am on the sheet.

Code:
With Sheets("Exchange Rates")
        .Range("B19", Range("B19").End(xlToRight)).ClearContents
End With

Code:
Sheets("Exchange Rates").Range("B19", Range("B19").End(xlToRight)).ClearContents

Any suggestions please?

Thanks
 

Some videos you may like

Excel Facts

Test for Multiple Conditions in IF?
Use AND(test, test, test, test) or OR(test, test, test, ...) as the logical_test argument of IF.

steve the fish

Well-known Member
Joined
Oct 20, 2009
Messages
8,110
Office Version
  1. 365
Platform
  1. Windows
You missed a dot:

Code:
With Sheets("Exchange Rates")
    .Range("B19", [COLOR=#ff0000].[/COLOR]Range("B19").End(xlToRight)).ClearContents
End With
 

Watch MrExcel Video

Forum statistics

Threads
1,109,028
Messages
5,526,332
Members
409,696
Latest member
EERS

This Week's Hot Topics

Top