View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Use of Range Property

Arnold,

Replace everything you have with

Range("A2").CurrentRegion.SpecialCells(xlCellTypeB lanks).Value = "0"

or

Range("A2").CurrentRegion.SpecialCells(xlCellTypeB lanks).Value = 0

HTH,
Bernie
MS Excel MVP


"Arnold Klapheck" wrote in message
...
I am trying to tighten up some old code that used a loop to change blank
cells to 0.
I want to use the following code but it doesn't work.

Range("A2").Select

Set MyRange = ActiveCell.CurrentRegion

MyRange.Select

Range(MyRange).SpecialCells(xlCellTypeBlanks) = "0" ' this does not work
' old code had a loop structure here using MyRange and it works but is slow

if I use [Range(a1:aq237).SpecialCells(xlCellTypeBlanks) = "0"] then it
works fine, any ideas.
thanx