View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Lars-Åke Aspelin[_2_] Lars-Åke Aspelin[_2_] is offline
external usenet poster
 
Posts: 913
Default If Range R Is Nothing Exit otherwise Copy Another Range

On Wed, 24 Dec 2008 14:40:00 -0800, MikeF
wrote:

The subject pretty much says it all, code example as follows.
Should be ultimately simple.
But it doesn't work.
An "else without if" error appears.
Where am I going wrong??
Thanx,
- Mike


Sub APUcopy()

Dim r As Range
Set r = Range("a28")

If r Is Nothing Then Exit Sub
Else
Range("I7:I26").Copy Destination:=("i28.i47")
End If
End Sub



Try with an new line after Then so that Exit Sub is on a separate
line.

Hope this helps / Lars-Åke