If Else statement
You could use:
If DelRng6 Is Nothing Then
Else
DelRng6.EntireRow.Delete
End if
or
If not (DelRng6 Is Nothing) Then
DelRng6.EntireRow.Delete
end if
I like:
If DelRng6 Is Nothing Then
'do nothing
Else
DelRng6.EntireRow.Delete
end if
I think it makes it easy to see what's happening.
Rokuro kubi wrote:
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
--
Dave Peterson
|