Hello,
I am currently using the following code to select rows where a cell contains a specific value. For example:
The above code looks for the word canceled and deletes any rows where "canceled" is found in column F.Code:Dim d As Range Dim rngD As Range For Each d In Intersect(ActiveSheet.UsedRange, Columns("F")) If d = "Canceled" Then If rngD Is Nothing Then Set rngD = d.EntireRow Set rngD = Union(rngD, d.EntireRow) End If Next d rngD.Select Selection.Delete
However, when "canceled" is not in any cell in column F, i get a "Runtime error '91': Object variable or With block variable is not set"
Is there a way around this? I'm a complete novice to VB and generally to most types of programing.
Many thanks!




Reply With Quote