Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#2
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
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 |
#3
![]()
Posted to microsoft.public.excel.misc
|
|||
|
|||
![]()
Cheers Dave
|
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
reconcile two months statement? | Excel Discussion (Misc queries) | |||
SET statement tutorial | Excel Discussion (Misc queries) | |||
If statement | Excel Discussion (Misc queries) | |||
Do I need a sumif or sum of a vlookup formula? | Excel Worksheet Functions | |||
IF Statement | New Users to Excel |