Thread: A simpler way
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Ron Rosenfeld Ron Rosenfeld is offline
external usenet poster
 
Posts: 5,651
Default A simpler way

On Thu, 22 Jan 2009 16:27:01 -0800, veryeavy
wrote:

Hi,

Is there a more efficient was of writiing the following code:

Application.Goto Reference:="ICT1"
Selection.ClearContents

Application.Goto Reference:="ICT2"
Selection.ClearContents

Application.Goto Reference:="ICT3"
Selection.ClearContents

Application.Goto Reference:="ICT4"
Selection.ClearContents

ICT1 etc. are simply non-contiguous named ranges.

Thanks in Advance and all the best as always,

Matt


Simpler would be:

==================
Range("ICT1,ICT2,ICT3,ICT4").ClearContents
=================

However, you should be aware that these Names will not be legal in Excel 2007
in native mode, as ICT1, etc, are all valid cell references.
--ron