View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.misc
Rokuro kubi
 
Posts: n/a
Default If Else statement

I'm fairly new to this and there are some frustrating gaps in what I
know of the basics. In the last section of code below, in the event
that DelRng6 = Nothing, how do I get the macro to simply move on to the
next code without doing anything else?

Dim DelRng6 As Range

Set myRng = Range(Cells(1, ActiveCell.Column), _
Cells(Rows.Count, ActiveCell.Column).End(xlUp))

For Each myCell In myRng.Cells
If myCell.Value = "Value" Then
If DelRng6 Is Nothing Then
Set DelRng6 = myCell
Else
Set DelRng6 = Union(myCell, DelRng6)
End If
End If
Next myCell

If DelRng6 Is Nothing Then
??????
Else
DelRng6.EntireRow.Delete

Range("B2").Delete