Thread: debug help
View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Tom Ogilvy Tom Ogilvy is offline
external usenet poster
 
Posts: 27,285
Default debug help

Dim rng as Range
Sheets("Sheet1").Select
Range("B9:H117").Select
On Error Resume Next
set rng = Selection.SpecialCells(xlCellTypeBlanks)
On Error goto 0
if not rng is nothing then
Selection.Value = "n/a"
Selection.Font.ColorIndex = 0
End if
Range("J20").Select
Sheets("start").Select


or
Dim rng as Range
On Error resume next
set rng = Worksheets("Sheet1").Range("B9:H117"). _
specialCells(xlCellTypeBlanks)
On Error goto 0
if not rng is nothing then
rng.Value = "n/a"
rng.Font.ColorIndex = 0
End if


--
Regards,
Tom Ogilvy

"Jo" wrote in message
...
Hi
The following code works fine if the blank cells are
present, however it fails if they are not. How do I make
this more robust?
Thanks
Jo
Sheets("Sheet1").Select
Range("B9:H117").Select
Selection.SpecialCells(xlCellTypeBlanks).Select
Selection.Value = "n/a"
Selection.Font.ColorIndex = 0
Range("J20").Select
Sheets("start").Select